libxml

Ruby SaxParser Syntax

Hi All, I found this interesting post explaining how to use saxparser for large xml files in ruby http://www.ioncannon.net/programming/643/fast-xml-parsing-with-ruby/ I would like to use the line : parser = XML::SaxParser.file("posts.xml") in one of my controllers, but instead of a file I have an xml post from another app, can anyone hel...

libxml for python's utf encoding issue or mine?

hi all I'm trying to extract the "META" description from a webpage using libxml for python. When it encounters UTF chars it seems to choke and display garbage chars. However when getting the data via a regex I get the unicode chars just fine. Am I doing something wrong with libxml? thanks ''' test encoding issues with utf8 ''' from lx...

libxml2 crash on second use on Windows

Hi, I've been using libxml2 push parsing (SAX) to parse an incoming XML stream, this works well first time but crashes on the second attempt every time, my code looks like this: xmlSAXHandler saxHandler; memset(&saxHandler, 0, sizeof(m_SaxHandler)); xmlSAXVersion(&saxHandler, 2); saxHandler.initialized = XML_SAX2_MAGIC; // so we do th...

Memory Leaks in Lib Xml Parser

Hi Guys, If I do nil, I am not getting the leaks but I am getting the exceptions due to nil object. I am getting its retain count as 4. How can I make its retain count to 0 - (void) dealloc { printf("\n Hai I am in Dealloc Method of Customer Lib Xml Parser......................"); self.connection = nil; xmlFreeParserCtxt(_xmlParserCont...

LibXML internal and output encodings

I'm trying to write XML files with libxml2 in ISO-8859-1. But from the documentation it seems that for each text node that I create I'll have to convert to UTF-8 which is libxml's internal encoding. Then when calling xmlSaveFormatFileEnc() libxml converts to the target encoding and adds the encoding attribute to the document. Is this a...

How can I save an XML DOM tree to a new document using Perl's XML::LibXML?

I write the following (DOM) Perl script (shown below) in order to create the following XML DOM: <books> <computer/> </books> How can I save the XML output into test.xml file? I tried to save the XML with $doc->printToFile('/tmp/test.xml'); but I get: can't locate object method "printToFile" via package "XML::LibXML::Document"...

Ruby libxml parsing and inserting to database

Hello, I am currently trying to read from an xml file which records the jobs on a PBS. I have succesfullly managed to parse the code, but am unable to insert the objtects into my database, i receive this error: "You have a nil object when you didn't expect it! You might have expected an instance of ActiveRecord::Base. The error occurred...

On libxml, how can I get this property value?

For an XML that has <?xml version="1.0" encoding="utf-8"?> <COLLADA version="1.4.0" xmlns="http://www.collada.org/2005/11/COLLADASchema"&gt; <library_geometries> <geometry id="Cube"> <mesh> <source id="Cube"> <float_array count="24" ">1 2 3</float_array> [..] I'm getting properly "1 2 3" string with a if (!xmlStrcmp(c...

adding newline to xml file while creating using libxml1.2.3

Hi. How can one add new line using libxml1.2.3. in xml file. ...

can't compile for release, can for debug? [iphone]

Hi I'm trying to compile my project, containing cocos2d and standard UIKit part, i'm trying to do this for iphone 3g/3Gs. The problem is, when i'm building it for debug configuration, it goes like on butter (no errors). But, when i switch to release, i've got over 1300 errors, all of them are like: printscreen almost all of them conta...

Validate XML using LibXML

Hi All, Currently, I am using the XML::LibXML perl module to validate an XML file against a defined XML schema. At the moment, if my XML file fails to validate successfully against the defined XML Schema, I will get a list of errors informing me, for example that certain elements were not expected and then what was expected instead. In ...

libxml2 use for ipad

When I use libxml2 in my ipad project (i use the dylib and add the header flags correctly) it doesn't build and gives the error: /Xcode4/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.2.sdk/usr/include/libxml2/libxml/xmlversion.h:24 Expected '=','','.','asm' or 'atrribute' before 'void'. line 23-25 of xmlversion.h ...

Searching nodes - Libxml

Hello all... I am trying to parse an XML document in C++. I do not have any form of metadata associated with the document. Since i am a novice with XML's i wanted to understand the best way to parse this xml. I am using libxml2 to achive this. What i am doing currently is 1) walking the complete tree node by node , using pointers of ...

Pass character stream to libxml2

Hi, I have a XML document which is received as a character stream. I wish to parse this using libxml2. Well one way would be to save it as an .xml and then open it using one of the libxml2 API's. Is there a way i can directly build a tree on this stream and parse it ? Env is purely c++/c. Cheers! ...

libxml2 XPATH - Selecting subset of data from XML

Hi guys, I am fairly new to XML dev.. I had a few questions regarding XML parsing with XPATH and libxml. I have an XML structured as : <resultset> <result count=1> <row> <name> He-Man! </name> <home> Greyskull </home> <row> </result> <result count=2> ...

Requesting complete, compilable libxml2 sax example.

I'm having a heck of a time figuring out how to use the sax parser for libxml2. Can someone post an example that parses this XML ( yes, without the <xml...> header and footer tags, if that can be parsed by the libxml2 sax parser): <hello foo="bar">world</hello> The parser should print out the data enclosed in element hello and also g...

PHP 5.3.3 fails to validate XML against nested XSD's... plz help!

After upgrading from PHP 5.2.8 to 5.3.3, the new libxml_disable_entity_loader(false) function does not seem to work on Windows via command line to a PHP file on a network share. More specifically, DOMDocument::schemaValidate() fails with XSD files that contain multiple levels of nested include()'s to other XSD files on a network share. ...

&lt; and &gt; are stripped out of the parse result when using PHP/libxml

Hello, (I'm using PHP 5.2.6 and phpinfo says it has libxml 2.6.32 loaded) I'm also using wordpress and whenever xml_parse() function is called I get &lt; and &gt; stripped out from the result, instead of being converted to "<" and ">". I found people talking this is a bug which hits newer versions of libxml but I have the old one and...

libxml allocates too much memory on the iphone

Hello everybody, I have a problem with the libxml parser on the iPhone! Im using the PerformXMLXPathQuery to parse a xml file with about 100'000 lines. The app breaks while running the PerformXMLPathQuery because it runs out of memory. What can I do here? Thanks, Markus ...

XPath how to select the first element without loading the whole xml?

Hello everybody, Im using libxml2 on the iPhone with the nice Method: PerformXMLXPathQuery from Cocoa with Love. The problem is how to find out witch xml got sent without first parsing the whole document... I tried to use the @"/" query to retrieve the first element as written on the introduction of Cocoa with Love but unfortunately, th...