I’m using php with xmlreader. I’m trying to read an file with an include statement in it. It appears that xmlreader doesn’t know what to do with the include and just treats it as a “normal” element. the reader looks like this at the moment.
if (!$reader->open($file)) {
die("Failed to open '.xml'");
}
while($reader->read()) {
echo $reader->nodeType . " " . $reader->name . "<br/>";
}
$reader->close();
the top level XML looks like this :
<?xml version="1.0" ?>
<?xml-stylesheet type="text/xsl" href="AdvDisad.xsl"?>
<!DOCTYPE kaw [ <!ENTITY brvbar "|"> ]>
<mydata xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="adv.xml"/>
</mydata>
the output is this :
7 xml-stylesheet
10 kaw
1 mydata
14 #text
1 xi:include
14 #text
15 mydata
as you can see, the xi isn’t interpreted as anything special. Do I need to process it myself ? if so, does the entity get passed along ? it’s my reason for bothering with the include in the first place.
One of the
LIBXMLoptions you can pass to XMLReader instructs it to substitute XIncludes:PHP’s DOM extension can also resolve XIncludes “manually,” with the
xincludemethod: