Re: [xml] calling xmlXIncludeProcess after xmlParseFile generates error



Christopher J. Grayce said:

Dear All,

   I would appreciate any enlightment on why this program works as
expected...
  <snip>
...but THIS program generates a segmentation violation:
  <snip>

   Clearly I am missing something about when xmlParseFile versus
xmlReadFile should be used.

The reason for this behaviour is really very simple to explain -
there was a bug in the library :-) (xinclude.c, now fixed in CVS).

   I also wonder what the purpose of the third (options) argument to
xmlReadFile is.  Setting it to XML_PARSE_INCLUDE doesn't cause
XInclude
processing to occur immediately after parsing, as I would have
thought it
would. . .

The option XML_PARSE_INCLUDE is only used by the xmlTextReader
interface, and has no effect when used with xmlReadFile or
xmlParseFile (you can easily check this by doing a "grep
XML_PARSE_INCLUDE *.c" in the library source directory).


   The version of libxml2 is 2.6.4, compiled from source (with no
errors)
under RedHat 9.0.

   Thanks in advance,
   CJG

Try the modified source from CVS - several other problems with
xinclude have also been fixed.  It seems to work okay for me:
bill billsuper list $ ./curious source.xml
<?xml version="1.0"?>
<element xmlns:xi="http://www.w3.org/2003/XInclude";>
   <element>what's up, Doc?</element>
</element>

Regards,

Bill



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]