php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46199 Bug in xml_parser example
Submitted: 2008-09-29 19:37 UTC Modified: 2008-10-05 04:13 UTC
From: josef dot buk at volny dot cz Assigned: kalle (profile)
Status: Not a bug Package: Documentation problem
PHP Version: 5.2.6 OS: Win XP Pro SP3
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: josef dot buk at volny dot cz
New email:
PHP Version: OS:

 

 [2008-09-29 19:37 UTC] josef dot buk at volny dot cz
Description:
------------
There is an error in the first example from 24-May-2008 05:30.


The result gives:




Reproduce code:
---------------
Try this:

just a copy of the class definition and
 
$xml=new xx_xml("<aa>aaa1<bb databb='xbxb'>bbbb1</bb>aaa2<cc>ccc1</cc>aaaa3</aa>","contents");
print_r($xml->data);

Expected result:
----------------
Array
(
    [aa] => Array
        (
            [data] => Array
                (
                    [0] => aaa1
                    [1] => aaa2
                    [2] => aaa3
                )

        )

    [aa|bb] => Array
        (
            [databb] => xbxb
            [data] => Array
                (
                    [0] => bbbb1
                )

        )

    [aa|cc] => Array
        (
            [data] => Array
                (
                    [0] => ccc1
                )

        )


Actual result:
--------------
Array
(
    [aa] => Array
        (
            [data] => Array
                (
                    [0] => aaa1
                )

        )

    [aa|bb] => Array
        (
            [databb] => xbxb
            [data] => Array
                (
                    [0] => bbbb1
                    [1] => aaa2
                )

        )

    [aa|cc] => Array
        (
            [data] => Array
                (
                    [0] => ccc1aaaa3
                )

        )


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-09-30 09:08 UTC] tularis@php.net
I must be missing something, but "There is an error in the first example from 24-May-2008 05:30." points to some kind of example... Where would this example be exactly? The documentation? If so, could you give us the URL you found it at ?
 [2008-09-30 18:48 UTC] josef dot buk at volny dot cz
Hi.
I apologize. url=http://cz2.php.net/manual/en/function.xml-parse.php
The first example - the definition of xx_xml class. Copy it and add the lines I mentioned:
<?php

... copy class xx_xml { ... } ...

$xml=new xx_xml("<aa>aaa1<bb
databb='xbxb'>bbbb1</bb>aaa2<cc>ccc1</cc>aaaa3</aa>","contents");
print_r($xml->data);
?>

You get the result I wrote. The problem is, that the text aaa2 and aaa3 are placed wrongly to [aa|bb] resp. [aa|cc] sections.

Josef
 [2008-10-05 04:13 UTC] kalle@php.net
Bogus, this is a user comment and not an actual documentation issue :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 21:01:35 2025 UTC