libxml2

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...

libxml2 error with namespaces and xpath

hello, I am pasting some code here that compiles with no warning using gcc file.c -lxml2, assuming that libxml2 is installed in your system. #include libxml/parser.h> #include libxml/xpath.h> #include assert.h> #include libxml/tree.h> #include libxml/xpathInternals.h> xmlDocPtr getdoc (char *docname) { xmlDocPtr doc; doc = x...

libxml - issue with non UTF-8 urls

When using libxml2 to parse non-UTF8 encoded HTML, htmlDocContentDumpOutput returns empty data. URL used to test : http://www.asahi.com/national/update/0628/TKY201006280289.html and askmen.com I don't know encoding used before hand. NSData * data = [[NSData alloc] initWithContentsOfURL:_url options:0 error:&error]; CFStringEncoding cf...

Filtering out namespace errors when parsing partial XML via libxml2 in C++

Hi guys, I have the need to parse partial XML fragments (which are presented as std::string), such as this one: <FOO:node>val</FOO:node> as xmlDoc objects in libxml2, and because these are fragments, I keep getting the namespace error : Namespace prefix FOO on node is not defined errors spit out into STDERR. What I am looking for is ...

XCode and Instruments: How to get the app memory peak

I'd like to show the memory peak (not 'leak', but the highest quantity of memory used in small amount of time) of an iPhone app i am running in the simulator. Where shall i look precisely? PS I am using libxml2 and i suppose that the allocations done by the library aren't considered ...

i want to parse data using SOAP and libxml2 so how it possible?

i have soap based Xml using that soap message i want to perform libxml parsing also perform lazy loading so how can i perform it please any one have idea about it then please help me. ...

python/xpath guru issue?

hi. using python 2.4/2.5, with libxm2dom. trying to get my haed around a question/issue that I'm considering. I have a doc I import the doc, and can build the DOM (libxml2dom) I'm trying to figure out if there's a way to programatically "search" for a given term, and be able to craft the XPath function to extract the href for the te...

TouchXML - Invalid XML does not return error object

Say I have an invalid XML. For some reason, TouchXML still sees it as a valid object. For example: NSString *str = @"?> obviously invalid!"; NSData *data = [str dataUsingEncoding:NSASCIIStringEncoding]; NSError *parseError = nil; CXMLDocument *document = [[[CXMLDocument alloc] initWithData:data encoding:NSASCIIStringEncoding options:0...

Python and libxml2: how to iterate in xml nodes with XPATH

I have a problem with retrieving information from a XML tree. My XML has this shape: <?xml version="1.0"?> <records xmlns="http://www.mysyte.com/foo"&gt; <record> <id>first</id> <name>john</name> <papers> <paper>john_1</paper> <paper>john_2</paper> </papers> </record> <record> <id>second</id> <...

Axis2/C - Libxml2

Hello every one! Has any one managed to use libxml2 with axis2c. Please correct me if i am wrong , if one goes with libxml2, all parsing/creation will be done by libxml2 api and not axiom api.. I would love to see a simple example for managing requests & response.I had a look at the wrapper classes , unfortunately i can not make how to...

Building the latest iconv and libxml2 binaries in Win32

I'm trying to get MinGW and MSYS working so I can build iconv and libxml2 in Windows, but I'm finding ./configure and make are giving lots of BSD/Unix related errors that aren't specific enough to google, and not descriptive enough for me to figure out. Can anybody go through some of the steps needed to get iconv and libxml2 .dll/.lib b...

Collada loading with libxml2

Hi! I want to load collada with libxml2. I get the COLLOADA node, okay, then I try to get the children tag - FAIL, the children tag name is "text". Why? How can i get the child of COLLADA node? xmlNode* geometries = xmlDocGetRootElement(doc)->children; //at THIS point the geometries->name == "text" WHY? //IS not it supposed to be "as...

Replace /upgrade libxml2 in xampp 1.7.1 linux

I have xampp 1.7.1 installed on linux, and i need to update libxml2 to version 2.7.3. Can anyone help me? I suppose that i need to recompile php but first i need to install libxml2 and i don't know how. Thanks in advance, ...

Reading web pages with Python

I'm trying to read and handle a web-page in Python which has lines like the following in it: <div class="or_q_tagcloud" id="tag1611"></div></td></tr><tr><td class="or_q_artist"><a title="[Artist916]" href="http://rateyourmusic.com/artist/ac_dc" class="artist">AC/DC</a></td><td class="or_q_album"><a title="[Album374717]" hr...

Why does libxml2 output "text" on an element name (when it's not "text")?

I am use libxml2 for XML parsing. The sample code on the libxml website are hard to follow and seem to lack some details. I arrived at the following code by Googling so I don't even think it's the proper way to do it, but it worked in the sample learning program I wrote, but not this one. I still don't know the proper way to use libxml i...

How do I get the content with libxml2?

I'm using libxml2 and C++. The following function crashes here at return (char*)cur->content;. When I change it to return (char*)cur->name; then it will return attribute which is the name of the tag. What I want is 1, 2, and 3 (based on the XML file below the C++ code). What am I doing wrong? char* xml2sdf::getId(xmlNode* part){ xm...

Which is faster, libxml2 or Xpath?

So, when it comes to xml, is using libxml or xpath faster? ...

libxml2 HTML chunk parsing

I'm downloading HTML from a website. The file can be quite large so while the file's downloading, I want to already parse the available chunks of HTML so that the process appears faster for the end-user of my program. I don't have control over how the cunks are generated, so a chunk can begin in the middle of a word, e.g. like so: chunk...

read from stdin for libxml2 in C

Hello, I would like to know the best way to parse a large amount of xml from stdin (data getting piped) into a program I am writing using libxml2. I can parse fine using a reader from the function xmlTextReaderPtr reader = xmlNewTextReaderFilename(filename) when I have a char * to the name of the file. I would preferably like to wind...

libxml2 HTML parsing problems

I'm using libxml2 to parse HTML: static htmlSAXHandler simpleSAXHandlerStruct = { NULL, /* internalSubset */ NULL, /* isStandalone */ NULL, /* hasInternalSubset */ NULL, /* hasExternalSubset */ NULL, /* res...