libxml2

XPath query result order

不问归期 提交于 2019-11-26 22:18:33
问题 For another question I have created some XML related code that works on my development machine but not on viper codepad where I tested it before adding it to my answer. I could reduce my problem to the point that the order of nodes returned by DOMXPath::query() differs between my system and the codepad. XML: <test>This is some <span>text</span>, fine.</test> When I query all textnodes //child::text() the result differs: Viper Codepad: #0: This is some #1: , fine. #2: text My Machine: #0: This

Mac user and getting WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3

风格不统一 提交于 2019-11-26 19:35:26
I have done all kinds of research and tried many different things. I know this question has been answered many times, but none of the suggested solutions are working for me. After upgrading to Lion I am getting segmentation faults in Ruby. I'm fairly confident it's Nokogiri. So I installed libxml2 via Homebrew. I ran brew link libxml2 . Then I reinstalled Nokogiri using that version of the library. For proof: $ nokogiri -v # Nokogiri (1.5.0) --- warnings: [] nokogiri: 1.5.0 ruby: version: 1.9.2 platform: x86_64-darwin11.0.0 description: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64

libxml/tree.h no such file or directory

浪尽此生 提交于 2019-11-26 19:29:12
I am getting following errors. libxml/tree.h no such file or directory I have already added libxml2.dylib to my project, however I am getting this type of trouble. Please help me. Matt Ball Follow the directions here , under "Setting up your project file." Setting up your project file You need to add libxml2.dylib to your project (don't put it in the Frameworks section). On the Mac, you'll find it at /usr/lib/libxml2.dylib and for the iPhone, you'll want the /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/usr/lib/libxml2.dylib version. Since libxml2 is a .dylib (not a

How do I return '' for an empty node's text() in XPath?

自作多情 提交于 2019-11-26 18:31:24
问题 <td></td><td>foo</td> I would like to return ['', 'foo'] but libxml's xpath //td/text() returns just ['foo'] . How do I find the empty tag as '' instead of (not matched)? 回答1: As long as you are selecting text nodes specifically, you can't. Because there simply is no text node in the first <td> . When you change your XPath expression to '//td' , you get the two <td> nodes. Use their text value in further processing. 回答2: While @Tomalak is perfectly right, in XPath 2.0 one can use : //td

Error to install Nokogiri on OSX 10.9 Maverick?

[亡魂溺海] 提交于 2019-11-26 15:39:33
I upgraded my OSX (Lion) to Mavericks and I can't install Nokogiri for my projects. I already install XCode 5.0.1, Command Line Tools (using xcode-select --install ), and already installed libxml2 from Homebrew and I am still having problems. The error is: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb checking for libxml/parser.h... *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more

Install libxml2 and associated python bindings - Windows

给你一囗甜甜゛ 提交于 2019-11-26 10:35:28
问题 I am attempting to install libxml2 so that I can setup the python bindings and eventually use lxml. However I am unable to work out here on earth I am supposed to be unzipping the files. I haven\'t been able to google successfully. Do I need Cygwin/MinGW for the installation to be successful? At the moment I have the files from the libxml2.tar.gz and libxslt.tar.gz in their respective directories within my Python folder. So files that were in the tars under include are in Python26\\include\

PHP, SimpleXML, decoding entities in CDATA

孤人 提交于 2019-11-26 09:57:32
问题 I\'m experiencing the following behavior: $xml_string1 = \"<person><name><![CDATA[ Someone's Name ]]></name></person>\"; $xml_string2 = \"<person><name> Someone's Name </name></person>\"; $person = new SimpleXMLElement($xml_string1); print (string) $person->name; # Someone's Name $person = new SimpleXMLElement($xml_string2); print (string) $person->name; # Someone\'s Name $person = new SimpleXMLElement($xml_string1, LIBXML_NOCDATA); print (string) $person->name; # Someone's Name The php docs

libxml/tree.h no such file or directory

冷暖自知 提交于 2019-11-26 08:58:21
问题 I am getting following errors. libxml/tree.h no such file or directory I have already added libxml2.dylib to my project, however I am getting this type of trouble. Please help me. 回答1: Follow the directions here, under "Setting up your project file." Setting up your project file You need to add libxml2.dylib to your project (don't put it in the Frameworks section). On the Mac, you'll find it at /usr/lib/libxml2.dylib and for the iPhone, you'll want the /Developer/Platforms/iPhoneOS.platform

iPhone Development - XMLParser vs. libxml2 vs. TouchXML

主宰稳场 提交于 2019-11-26 08:46:58
问题 I cannot find comparison of these parsing technique. Which one is most commonly used? Regards. Mustafa 回答1: NSXMLParser is a SAX parser, meaning it steps through the XML document, and informs you (via delegate methods) of various events (such as starting an xml node, finding attributes, etc). This type of XML processing is best for parsing huge documents, and when you only need to retrieve a tiny amount of data from a big file. In contrast to SAX is the DOM model, where the entire XML tree is