Hi there. I'm hoping someone can help me with what I think might be a
slightly obscure problem.
I'm trying to get the SimpleXML extension to read an XML file and
process the XInclude statements within the XML file.
The SimpleXML docs state that libxml options may be specified using the
predefined constants that are available when PHP is compiled with libxml
support (as it is when you use SimpleXML).
http://uk2.php.net/manual/en/function.simplexml-element-construct.php
So, looking at the libxml options, I see there is a predefined constant
LIBXML_XINCLUDE which when specified should implement XInclude
substitution. So my SimpleXML object I define as follows:
$xml_file = './master.xml';
$xml = new SimpleXMLElement($xml_file, LIBXML_XINCLUDE, true);
print_r($xml);
Viewing the resulting datastructure shows me that it has not honoured
the request to implement the XInclude directives.
Does anyone know if a) I'm using the correct syntax for this, and b)
have any experience of getting this working.
My master.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
<foo>ssd</foo>
<bar>sss</bar>
<xi:include href="a.xml">
<xi:fallback>
<error>xinclude - a.xml not found</error>
</xi:fallback>
</xi:include>
</root>
and then I have a.xml which looks like:
<?xml version="1.0" encoding="UTF-8"?>
<a_root>
<oranges>test</oranges>
<apples>test more</apples>
</a_root>
I'm running PHP 5.1.5 with libxml 2.6.20 on Fedora Core 4 linux.
Cheers
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php