<?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

 

 

 

 

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-06
  • 2021-05-21
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2021-08-16
  • 2021-09-02
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
相关资源
相似解决方案