(PHP 5)
DomDocument::xinclude — XInclude dosyalarını belgeye dahil eder
» XInclude mekanizması kullanılarak belgeye dahil edilen dosyaları belgeye ekler.
Örnek 1 - Belgeye dosya eklemek
<?php
// ithal.xml içeriği:
// <child>test</child>
$xml = '<?xml version="1.0"?>
<root xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="ithal.xml">
<xi:fallback>
<error>xinclude: ithal.xml bulunamadı</error>
</xi:fallback>
</xi:include>
</root>';
$domxml = domxml_open_mem($xml);
$domxml->xinclude();
echo $domxml->dump_mem();
?>
Yukarıdaki örneğin çıktısı:
<?xml version="1.0"?> <root xmlns:xi="http://www.w3.org/2001/XInclude"> <child>test</child> </root>
Eğer ithal.xml mevcut olmasaydı çıktı şöyle olurdu:
<?xml version="1.0"?> <root xmlns:xi="http://www.w3.org/2001/XInclude"> <error>xinclude: ithal.xml bulunamadı</error> </root>