libxml2

Load XML from string in libxml++ in C++

Does anyone familiar with libxml++ know if it's possible to load the XML document from a string instead of a file? Alternately, if it can load a document directly from a web page, that would do. Thanks ...

XML::LibXML Line Ending (whitespace) Problem.

HI, I am parsing an XML file using LibXML in Perl. The problem that I have is the ending characters (whitespace) is treated as a text node. For instance, given an input like the following <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE books [ <!ELEMENT title (#PCDATA)> <!ELEMENT author (#PCDATA)> <!ELEMENT year (#PCDATA...

Disable debug output in libxml2 and xmlsec

Hi, In my software, I use libxml2 and xmlsec to manipulate (obviously) XML data structures. I mainly use XSD schema validation and so far, it works well. When the data structure input by the client doesn't match the XSD schema, libxml2 (or xmlsec) output some debug strings to the console. Here is an example: Entity: line 1: parser er...

Can I use relative XPath expressions in libxml2?

I am wondering whether it is possible to use relative XPath expressions in libxml2. This is from the javax.xml.xpath API and I would like to do the similar thing using libxml2: Node widgetNode = (Node) xpath.evaluate(expression, document, XPathConstants.NODE); With a reference to the element, a relative XPath expression can n...

Parsing HTML fragments with libxml SAX

I need to parse HTML fragments, by which I mean the files lack <html>, <head> and <body> elements, otherwise having well-formed XHTML syntax, UTF8 encoding guaranteed. It looks like libxml is ideal for this task, but I have certain constraints which I just don't know how to implement. htmlSAXParseFile() does its job well enough, but it...

How to write to an XML file from the iPad OS?

I am developing an app for IPad, and I need to modify several attributes in a XML file at runtime. I found the class NSXMLDocument, http://developer.apple.com/mac/library/documentation/cocoa/reference/foundation/Classes/NSXMLDocument_Class/Reference/Reference.html But I haven't been able to import it to my project. Is this class not a...

Memory leaks in libxml2.2

I am using libxml2 to parse xml content in my iPhone app. The xml content is downloaded from a server similar to the Apple's own TopSongs sample app. When I check for leaks using the Instruments tool, I see memory leaks being reported on xmlNewParserCtxt, xmlNewInputStream and xmlAllocParserInputBuffer. I have called xmlFreeParserCtxt(co...

RVM doesn't work for 1.9.1 but works for 1.8.6 and 1.8.7

UPDATE 6/25/10 Using Google, I am not the only person to encounter this problem. Apparently this problem has to do with readline. Has anyone out there encountered this issue? (see error at make.error.log below) As google suggests, I compiled readline: curl -O ftp://ftp.gnu.org/gnu/readline/readline-6.1.tar.gz tar xzvf readline-6.1.tar....

Leopard => Snow Leopard architecture woes with nokogiri / rails

I'm confused. It's a regular state of affairs for me but specifically in this case I felt I could reach out to fellow stackoverflowers (that is, stackoverflow-ers, not stackover-flowers). uname -a Darwin macbookpro 10.3.0 Darwin Kernel Version 10.3.0: Fri Feb 26 11:58:09 PST 2010; root:xnu-1504.3.12~1/RELEASE_I386 i386 set bash-3.2$ s...

creating xml element with two namespaces using libxml APIs

Hi, I want to create an xml element having two namespace as below: element name="Root" xmlns:xsi="myXSI" xmlns:xsd="myXSD" I have checked out with the existing APIs, but it is not getting in this form. I am getting as Root xmlns:xsd:xsi="myXSI" xmlns:xmlns:xsd="myXSD" I am using this APIss as below: xmlTextWriterWriteAttributeNS(xm...

How to undo ./configure command

Hi, Is there a command that removes all the files created by the ./configure command of libxml2?? Thanks Samuel ...

libxml2 on iPhone

I'm trying to parse HTML file with libxml2. Usually this works fine, but not in this case: <p> <b>Titles</b> (Some Text) <table> <tr> <td valign="top"> …Something1... </td> <td align="right" valign="top"> …Something2... </td> </tr...

Simple libxml2 HTML parsing example, using Objective-c, Xcode, and HTMLparser.h

Please can somebody show me a simple example of parsing some HTML using libxml. #import <libxml2/libxml/HTMLparser.h> NSString *html = @"<ul><li><input type=\"image\" name=\"input1\" value=\"string1value\" /></li><li><input type=\"image\" name=\"input2\" value=\"string2value\" /></li></ul><span class=\"spantext\"><b>Hello World 1</b></...

How to access xmlParserCtxt structure from within xmlSAXHandler callbacks?

I'm parsing (X)HTML pages content with libxml using the following call: htmlDocPtr doc = htmlSAXParseDoc(content, NULL, &html_handler, NULL); But for debugging purposes I need to analyze some of the current node properties in the start/end element callbacks. I know that the fourth argument of htmlSAXParseDoc can be used to pass any us...

Extract part of HTML in C/Objective-C

Hi, I need to extract the detail content of a website while preserve all formatting of the division. The section I wish to extract is: ... <div class="detailContent"><p> <P dir=ltr><STRONG>Hinweis</strong>: Auf ... </p> </div> ... My current solution is to use HTMLParser from libxml2 and xpath to find the nodes and walk through all ...

Issues in using 3rd party libraries while developing Apache Modules

Hello everyone! I am writing an Apache module for my internship. I am using C for this (I am not acquainted with Perl or Python that much). I need to use an HTML Parser to solve the problem for which I am writing this module. I am considering libxml2 for this purpose. I am confused how should I link the library in my module ? Should...

Undefined symbol error on loading a module in Apache that uses libxml2

Hello everyone! I am writing an Apache 2.2 module that uses the libxml2 API. I have compiled the module using following commands: apxs -I /usr/include/libxml2/ -c mod_xmltest.c sudo apxs -n xmltest_module -i mod_xmltest.la and used the following LoadFile directive in httpd.conf LoadFile /usr/lib/libxml2.so However on starting the...

libxml2 SAX query

I am trying to parse an XML file using the SAX interface of libxml2 in C. My problem is that whitespace characters between end of a tag and start of a new tag are causing the callback "Characters" to be executed...Hi All, i.e. <?xml version="1.0"?> <doc> <para>Hello, world!</para> </doc> produces these events: ...

Factors in deciding whether to use DOM, SAX or XPath

Hello everyone. I am in a kind of an weird condition in my code. I am writing an Apache module that needs to add a comment in the head tag of the response document (apart from doing some other unimportant stuff). At the point where I need to parse the response document, I have the whole document in memory in the form of a char * buffer...

creating and adding a new child element to an xml document using the SAX interface of libxml2

Hello everyone. My problem is that I need to parse an HTML document chunk by chunk and add a comment in the head element of the document. I am using C and I found that libxml2 is the best library out there for this purpose. As I am receiving only chunks of data at a time I thought using a SAX parser would be a better option. Howeve...