[xml] Entity substitution problem with XInclude
- From: "Kevin P. Fleming" <kpfleming backtobasicsmgmt com>
- To: xml gnome org
- Subject: [xml] Entity substitution problem with XInclude
- Date: Thu, 27 May 2004 21:12:17 -0700
The attached files demonstrate a problem I've having with libxml2
(tested with 2.6.9 and 2.6.10). I am using xmlParseFile with
xmlSubstituteEntitiesDefault set to 1.
Using xmllint on these files does not generate a problem. Using my code,
if I load test2.xml, everything works fine. However, if I load test.xml,
which XIncludes test2.xml, then the LFS entity reference inside the base
attribute in test2.xml is substituted, but instead an XML_ENTITY_NODE is
returned in the DOM tree. Since my code is not expecting any entity
nodes, it crashes :-)
Can anyone tell me what I'm doing to cause this behavior? This problem
did not occur before the files were converted to use XInclude, so
somehow that is affecting entity substitution.
<?xml version="1.0" encoding="iso-8859-1"?>
<!ENTITY LFS "/mnt/lfs">
<!ENTITY LFS-version "CVS-20040524">
<!ENTITY packages_dir "/tools/packages-&LFS-version;">
<!ENTITY build_dir "/tools/build">
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE alfs SYSTEM "ALFS-3.1.dtd" [
<!ENTITY % general_entities SYSTEM "general.ent">
%general_entities;
]>
<alfs>
<stage name="Creating tools directory.">
<mkdir base="&LFS;">
<option>parents</option>
<name>&LFS;&packages_dir;</name>
<name>&LFS;&build_dir;</name>
</mkdir>
</stage>
</alfs>
<?xml version="1.0" encoding="iso-8859-1"?>
<alfs version="3.1" xmlns:xi="http://www.w3.org/2001/XInclude">
<stage name="Chapter 5 - Constructing a temporary system">
<xi:include href="test2.xml" />
</stage>
</alfs>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]