From:             [EMAIL PROTECTED]
Operating system: windows
PHP version:      4.2.1
PHP Bug Type:     DOM XML related
Bug description:  [chm] bug on ref.domxml.html

Well, I am reading bugs of how to get the different objects and components
of an xml document, and I have got a simply and fine solution that is like
follow,
<?php
$my_xml_file = file("books.xml") or die("Error...<br>");
$dom_tree = domxml_xmltree( $my_xml_file[0] );
echo "DOMTREE loaded<br>";
print("<pre>");
print_r( $dom_tree );
print("</pre>");
echo "<br>\n";
?>
The best of it, you do not need the whole path to read the file and you
get the whole description of your DOM.

This is my "books.xml" file,
<?xml version='1.0' encoding='UTF-8'?><books><book><Title>La
peste</Title><Author>Albert
Camus</Author><Price>30</Price></book></books>
where the tree is listed in one only line.

And here is what I get with the above php code,

DOMTREE loaded

DomDocument Object
(
    [name] => #document
    [url] => 
    [version] => 1.0
    [encoding] => UTF-8
    [standalone] => -1
    [type] => 9
    [compression] => -1
    [charset] => 1
    [0] => 1
    [1] => 8040992
    [children] => Array
        (
            [0] => DomElement Object
                (
                    [type] => 1
                    [tagname] => books
                    [0] => 2
                    [1] => 8040880
                    [children] => Array
                        (
                            [0] => DomElement Object
                                (
                                    [type] => 1
                                    [tagname] => book
                                    [0] => 3
                                    [1] => 8040784
                                    [children] => Array
                                        (
                                            [0] => DomElement Object
                                                (
                                                    [type] => 1
                                                    [tagname] => Title
                                                    [0] => 4
                                                    [1] => 8040688
                                                    [children] => Array
                                                        (
                                                            [0] => DomText
Object
                                                                (
                                                                    [type]
=> 3
                                                                    [name]
=> #text
                                                                   
[content] => La peste
                                                                    [0] =>
5
                                                                    [1] =>
8040608
                                                                )

                                                        )

                                                )

                                            [1] => DomElement Object
                                                (
                                                    [type] => 1
                                                    [tagname] => Author
                                                    [0] => 6
                                                    [1] => 8040512
                                                    [children] => Array
                                                        (
                                                            [0] => DomText
Object
                                                                (
                                                                    [type]
=> 3
                                                                    [name]
=> #text
                                                                   
[content] => Albert Camus
                                                                    [0] =>
7
                                                                    [1] =>
8048576
                                                                )

                                                        )

                                                )

                                            [2] => DomElement Object
                                                (
                                                    [type] => 1
                                                    [tagname] => Price
                                                    [0] => 8
                                                    [1] => 8048512
                                                    [children] => Array
                                                        (
                                                            [0] => DomText
Object
                                                                (
                                                                    [type]
=> 3
                                                                    [name]
=> #text
                                                                   
[content] => 30
                                                                    [0] =>
9
                                                                    [1] =>
8048432
                                                                )

                                                        )

                                                )

                                        )

                                )

                        )

                )

        )

)

And that's it. I hope you like.

-- 
Edit bug report at http://bugs.php.net/?id=19742&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=19742&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=19742&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=19742&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=19742&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=19742&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=19742&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=19742&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=19742&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=19742&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=19742&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19742&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=19742&r=dst

Reply via email to