PHP Portal » PHP Handbuch » DomDocument->xinclude

Werbung

DomDocument->xinclude


(PHP 5)

DomDocument->xinclude Substitutes XIncludes in a DomDocument Object

Beschreibung

int DomDocument->xinclude ( void )

This function substitutes » XIncludes in a DomDocument object.

PHP Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// include.xml contains : // <child>test</child> $xml = '<?xml version="1.0" <root xmlns:xi="http://www.w3.org/2001/XInclude"> <xi:include href="manual/include.xml"> <xi:fallback> <error>xinclude: include.xml not found</error> </xi:fallback> </xi:include> </root>'; $domxml = domxml_open_mem($xml); $domxml->xinclude(); echo $domxml->dump_mem();

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

<?xml version="1.0"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
  <child>test</child>
</root>

If include.xml doesn't exist, you'll see:

<?xml version="1.0"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
  <error>xinclude:dom.xml not found</error>
</root>