libxml2

how to use libxml2 to modify an existing xml file?

I need to take an existing xml file, and modify just a few attributes and write the file back out. I was thinking of using libxml2 to get this done. Application is C/C++ running on Linux. Thing is, libxml2 seems to include several variations of the kitchen sink, along with portable washrooms, showers, and various other things connecte...

Is it possible to use libxml with unicode xmlchar?

Is it possible to use libxml with unicode? For example the xmlParseDoc function takes an xmlChar xmlChar has the following definition: typedef unsigned char xmlChar; I would like for libxml to interpret all as 2 byte chars. I have a feeling that the following would not work properly with the lib: typedef unsigned short xmlChar; ...

iPhone Development - XMLParser vs. libxml2 vs. TouchXML

I cannot find comparison of these parsing technique. Which one is most commonly used? Regards. Mustafa ...

How to apply successively two xpath expressions with libxml?

Hi, To sum up, i'm a totally beginner in libxml and I have to use an existing source code. The main idea is to apply a first xpath expression to extract a set of nodes from an xml file. Then, for each node, the second xpath expression shall be applied to extract some values. Existing source code is: int xt_parseXmlResult(xmlDocPtr doc...

Install PHP 5 without libxml2

I am trying to install a copy of PHP 5 to my home directory on the school computer. The problem is that whenever I try, it complains that my copy of libxml2 is too outdated to work. Is there any way I can install this without upgrading libxml2, since I don't have permission to upgrade. Any suggestions? ...

Proper way to link against libraries from libraries for the iPhone/CocoaTouch

I'm writing a static library for the iPhone and I'm wondering if what I'm doing is recommended or if I should take a different approach. The static library I'm writing is dependant on libxml2. libxml2 has a dynamic library (dylib) and a static library (a). I've tried two approaches. Approach one - When I attempt to link against the s...

libxml2 replacement

I was looking for a better (well documented and efficient) xml processing C library. ¿ Ideas ? ...

Try to recover from an error with TouchXML

I'm trying to make an XPath query with TouchXML, but if the query fail, the programm crash immmediately. Is there any way to prevent this and continue the execution of the programme. I know that TouchXML is based on libxml2 and that lib have an option called XML_PARSE_RECOVER but i don't know how to use it with TouchXML. Source code ...

AttributeError: xmlNode instance has no attribute 'isCountNode'

I'm using libxml2 in a Python app I'm writing, and am trying to run some test code to parse an XML file. The program downloads an XML file from the internet and parses it. However, I have run into a problem. With the following code: xmldoc = libxml2.parseDoc(gfile_content) droot = xmldoc.children # Get document root dchild = d...

Getting html attributes from DOM trees ( libxml )

I'm using this program to display a list of all html tags in a given file: #include <cstdio> #include <libxml/HTMLparser.h> #include <libxml/tree.h> #include <iostream> #include <cstring> using namespace std; static void print_element_names(htmlNodePtr a_node) { htmlNodePtr cur_node = NULL; for (cur_node = a_node; cur_node!=N...

LibXML2 Sax Parsing and ampersand

I've encountered (what I think is) a strange behavior when using the sax parser, and I wanted to know if it's normal. I'm sending this XML through the SAX parser: The "& a m p ;" gets converted to " & # 3 8 ;" when the startElement callback is called. Is it supposed to do that? If so, I would like to understand why. I've pasted an...

Is it possible to disable stderr in C++?

I wrote a program for linux using libxml2 for html parsing. Although it does its job, the html parser writes lots of various errors to stderr. Is it possible to disable stderr at all (or redirect it to /dev/null while not having to run it with a redirecting shell script)? I can live with having to write my own errors to stdout, I just wa...

Memory issues when using LibXML

Default Getting Memory Issues when Using Libxml2 Hi all, This is the code we are using for application,I fgiving where we are getting the leaks. (void)connectionNSURLConnection *)connection didReceiveDataNSData *)data { xmlParseChunk(context, (const char *)[data bytes], [data length], 0); Here we are getting the leak } (void)dow...

How to get attributes from a node in libxml2 in iPhone

Hi all, I am working on a parser to get data from xml file,I am using libxml2 to extract data.I am a not able to get the attributes from nodes,I am using nb_attributes to get the count of the attributes,Can some one help me out Thank You ...

libxml for C++: How to add a root node to XML tree?

I have an xml file that looks like the following <siteinfo> ... </siteinfo> <page> <title>...</title> <revision> ... <revision> </page> It does not have a root/enclosing node so I get the "extra content at end of document" on running my program. After opening the file for parsing using libxml, is there a way to easily add ...

Parsing XML Encoded in UTF-8

I am working with a Wikipedia XML dump that is encoded in UTF-8. Right now, I am reading in everything as std::string, so when I std::cout to the screen, foreign characters are displayed as jibberish. The actual parsing process only looks for ASCII characters though, but when I write the parsed file to disk, I want to preserve the fore...

Copy xmlNodeSet from xmlXPathObject

How can I copy the xmlNodeSet from from a xmlXPathObject? This is my code now: xmlNodeSet *get_nodes( xmlDoc *doc, xmlChar *xpath ) { xmlXPathContext *context; xmlXPathObject *object; xmlNodeSet *nodeSet; xmlXPathObject *nObj; context = xmlXPathNewContext( doc ); object = xmlXPathEvalExpression( xpath, c...

Header Search Paths in XCode - Is it possible to set a macro or variables so they're relative to the SDK version?

Update: It appears that a recent XCode update may have changed this macro, please see this Question & Answer for more information: http://stackoverflow.com/questions/2292694/obtaining-older-sdkroot-behavior-in-xcode Situation: I'm using libxml2 on an iPhone project and I've added it as relative to the SDK version. However, in order to...

Validate XPath expression

I would like to validate a user-provided XPath query to ensure that it is syntactically correct. Does it make sense to "validate" an XPath query without an XML document? How can i achieve such a thing in libxml? ...

Python packages depending on libxml2 and libxslt

Apart from lxml, is anyone aware of Python packages that depend on libxml2 and libxslt? ...