我有一个XML提要,我需要从中解析一些并将其存储到MySQL表中,但是我面临一种新的XML(我不擅长这个)这是我从这个地址使用simplexml_load_file
打开的XML:这是一个公开出版的期刊出版物,我需要存储作者列表和其他一些,但有一个关于如何访问它的提示,我可以管理。谢谢你。
SimpleXMLElement Object
(
[DocSum] => SimpleXMLElement Object
(
[Id] => 22064119
[Item] => Array
(
[0] => 2011 Dec
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => EPubDate
[Type] => Date
)
)
[2] => Clin Nucl Med
[3] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => AuthorList
[Type] => List
)
[Item] => Array
(
[0] => Jackson TA
[1] => Choong KW
[2] => Eng JA
[3] => McAneny D
[4] => Subramaniam RM
[5] => Knapp PE
)
)
[4] => Knapp PE
[5] => F-18 FDG PET/CT Imaging of Endogenous Cushing Syndrome.
[6] => 36
[7] => 12
[8] => e231-2
[9] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => LangList
[Type] => List
)
[Item] => English
)
[10] => 7611109
[11] => 0363-9762
[12] => 1536-0229
[13] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => PubTypeList
[Type] => List
)
[Item] => Journal Article
)
[14] => PubMed - in process
[15] => ppublish
[16] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => ArticleIds
[Type] => List
)
[Item] => Array
(
[0] => 10.1097/RLU.0b013e3182336360
[1] => 00003072-201112000-00044
[2] => 22064119
[3] => 22064119
[4] => 22064119
)
)
[17] => 10.1097/RLU.0b013e3182336360
[18] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => History
[Type] => List
)
[Item] => Array
(
[0] => 2011/11/09 06:00
[1] => 2011/11/09 06:00
[2] => 2011/11/09 06:00
)
)
[19] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => References
[Type] => List
)
)
[20] => 1
[21] => 0
[22] => Clinical nuclear medicine
[23] => SimpleXMLElement Object
(
[@attributes] => Array
(
[Name] => ELocationID
[Type] => String
)
)
[24] => 2011 Dec;36(12):e231-2
)
)
)
您可以像这样在对象上运行XPath: $xml->xpath('/DocSum/Item/3/Item');