Annotation of embedaddon/php/ext/simplexml/tests/sxe_002.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: SPL: SimpleXMLIterator and recursion
        !             3: --SKIPIF--
        !             4: <?php 
        !             5: if (!extension_loaded('simplexml')) print 'skip';
        !             6: if (!extension_loaded("libxml")) print "skip LibXML not present";
        !             7: ?>
        !             8: --FILE--
        !             9: <?php 
        !            10: 
        !            11: $xml =<<<EOF
        !            12: <?xml version='1.0'?>
        !            13: <!DOCTYPE sxe SYSTEM "notfound.dtd">
        !            14: <sxe id="elem1">
        !            15:  Plain text.
        !            16:  <elem1 attr1='first'>
        !            17:   Bla bla 1.
        !            18:   <!-- comment -->
        !            19:   <elem2>
        !            20:    Here we have some text data.
        !            21:    <elem3>
        !            22:     And here some more.
        !            23:     <elem4>
        !            24:      Wow once again.
        !            25:     </elem4>
        !            26:    </elem3>
        !            27:   </elem2>
        !            28:  </elem1>
        !            29:  <elem11 attr2='second'>
        !            30:   Bla bla 2.
        !            31:   <elem111>
        !            32:    Foo Bar
        !            33:   </elem111>
        !            34:  </elem11>
        !            35: </sxe>
        !            36: EOF;
        !            37: 
        !            38: $sxe = simplexml_load_string((binary)$xml, 'SimpleXMLIterator');
        !            39: 
        !            40: foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) {
        !            41:        var_dump($name);
        !            42:        var_dump(get_class($data));
        !            43:        var_dump(trim($data));
        !            44: }
        !            45: 
        !            46: echo "===DUMP===\n";
        !            47: 
        !            48: var_dump(get_class($sxe));
        !            49: var_dump(trim($sxe->elem1));
        !            50: 
        !            51: ?>
        !            52: ===DONE===
        !            53: --EXPECT--
        !            54: string(5) "elem1"
        !            55: string(17) "SimpleXMLIterator"
        !            56: string(10) "Bla bla 1."
        !            57: string(5) "elem2"
        !            58: string(17) "SimpleXMLIterator"
        !            59: string(28) "Here we have some text data."
        !            60: string(5) "elem3"
        !            61: string(17) "SimpleXMLIterator"
        !            62: string(19) "And here some more."
        !            63: string(5) "elem4"
        !            64: string(17) "SimpleXMLIterator"
        !            65: string(15) "Wow once again."
        !            66: string(6) "elem11"
        !            67: string(17) "SimpleXMLIterator"
        !            68: string(10) "Bla bla 2."
        !            69: string(7) "elem111"
        !            70: string(17) "SimpleXMLIterator"
        !            71: string(7) "Foo Bar"
        !            72: ===DUMP===
        !            73: string(17) "SimpleXMLIterator"
        !            74: string(10) "Bla bla 1."
        !            75: ===DONE===

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