php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #19742 [chm] bug on ref.domxml.html
Submitted: 2002-10-03 15:37 UTC Modified: 2002-11-01 04:12 UTC
From: joseals-uned at eresmas dot net Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.2.1 OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: joseals-uned at eresmas dot net
New email:
PHP Version: OS:

 

 [2002-10-03 15:37 UTC] joseals-uned at eresmas dot net
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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-03 19:37 UTC] sniper@php.net
reclassified
 [2002-10-31 13:58 UTC] iliaa@php.net
Does the problem still exist in the latest version (10th edition) of the chm manual?
 [2002-11-01 04:12 UTC] goba@php.net
This bug is completely unrelated to the CHMs, and completely unrelated to the bug system. This should be posted as a user note or to a code library somewhere. => Closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 08 00:01:32 2025 UTC