Re: [xml] Issue with xmlParseInNodeContext and xmlParseCharData()
- From: Daniel Veillard <veillard redhat com>
- To: Frank Gross <fg 4js com>
- Cc: xml gnome org
- Subject: Re: [xml] Issue with xmlParseInNodeContext and xmlParseCharData()
- Date: Fri, 21 Mar 2014 17:08:20 +0800
On Wed, Mar 19, 2014 at 06:29:08PM +0100, Frank Gross wrote:
Hi,
Since libxml 2.8.0 I have an issue when I use
xmlParseInNodeContext(). During the parsing, it goes through the
xmlParseCharData() function where following test has been added
compared to libxml 2.7.2. And this test makes my parsing fail. For
instance, the node I parse is <a><b>data</b><c>other</c></a> and in
both libxml versions the ctxt->instate value is always
XML_PARSER_START, but with that test since libxml 2.8.0, an error is
raised when parsing the first text node.
Shouldn't the ctxt->instate value be set to XML_PARSER_CONTENT when
starting to parse the content from xmlParseInNodeContext() ? Or can
someone tell me what I'm doing wrong or maybe why that test has been
added ?
File parser.c at line 4321 :
/* something really bad happened in the SAX callback */
if (ctxt->instate != XML_PARSER_CONTENT)
return;
Regards,
Frank
Hum, yes that sounds right !
libxml2 does set ctxt->instate to XML_PARSER_CONTENT but only if the
node passed to graft the resulting data is an ELEMENT, that too limited
I think, could you try with the following patch ?
https://git.gnome.org/browse/libxml2/commit/?id=6faa126fc3ba24a782e832cb0000d6d4f6b7b576
A workaround is to make sure the node you pass as first parameter
of xmlParseInNodeContext is an element.
Daniel
--
Daniel Veillard | Open Source and Standards, Red Hat
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | virtualization library http://libvirt.org/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]