php simplexml_load_string 返回的对象print_r后,丢失信息?

<?php
$content = '<dblp>
<inproceedings key="conf/aaim/He07" mdate="2007-06-28">
<author>Dan He</author>
<title>
<i>BMA</i>
<sup>*</sup>
: An Efficient Algorithm for the One-to-Some Shortest Path Problem on Road Maps.
</title>
<pages>346-357</pages>
<year>2007</year>
<crossref>conf/aaim/2007</crossref>
<booktitle>AAIM</booktitle>
<ee>http://dx.doi.org/10.1007/978-3-540-72870-2_33</ee>
<url>db/conf/aaim/aaim2007.html#He07</url>
</inproceedings>
</dblp>';
$xml = simplexml_load_string($content);
print_r($xml);

 结果:

SimpleXMLElement Object
(
    [inproceedings] => SimpleXMLElement Object
        (
            [@attributes] => Array
                (
                    [key] => conf/aaim/He07
                    [mdate] => 2007-06-28
                )

            [author] => Dan He
            [title] => SimpleXMLElement Object
                (
                    [i] => BMA
                    [sup] => *
                )

            [pages] => 346-357
            [year] => 2007
            [crossref] => conf/aaim/2007
            [booktitle] => AAIM
            [ee] => http://dx.doi.org/10.1007/978-3-540-72870-2_33
            [url] => db/conf/aaim/aaim2007.html#He07
        )

)

  在title中丢失了信息,因为返回的是一个迭代对象,具体查看http://stackoverflow.com/questions/21660547/simplexml-load-string-has-a-bug

 

 

 

 

posted @ 2014-02-18 09:34  Martin2  阅读(386)  评论(0编辑  收藏  举报