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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
32 + 49 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 22:01:26 2024 UTC