Annotation of embedaddon/php/ext/xmlreader/tests/expand.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: XMLReader: Expand into existing DOM documet
        !             3: --SKIPIF--
        !             4: <?php if (!extension_loaded("xmlreader")) print "skip";
        !             5: if (!extension_loaded("dom")) print "skip";
        !             6: $reader = new XMLReader();
        !             7: if (!method_exists($reader, 'expand')) print "skip";
        !             8: ?>
        !             9: --FILE--
        !            10: <?php 
        !            11: 
        !            12: $basexml = '<?xml version="1.0" encoding="UTF-8"?>
        !            13: <books><book>base book</book></books>';
        !            14: 
        !            15: $xmlstring = '<?xml version="1.0" encoding="UTF-8"?>
        !            16: <books><book>new book</book></books>';
        !            17: 
        !            18: $dom = new DOMDocument();
        !            19: $dom->loadXML($basexml);
        !            20: 
        !            21: $reader = new XMLReader();
        !            22: $reader->XML($xmlstring);
        !            23: while ($reader->read()) {
        !            24:     if ($reader->localName == "book") {
        !            25:         $node = $reader->expand($dom);
        !            26:         if ($node->ownerDocument) {
        !            27:             echo $node->ownerDocument->documentElement->firstChild->textContent . "\n";
        !            28:         }
        !            29:         break;
        !            30:     }
        !            31: }
        !            32: $reader->close();
        !            33: ?>
        !            34: ===DONE===
        !            35: --EXPECT--
        !            36: base book
        !            37: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>