2012-08-08 252 views
0

所以我在XML以下混杂的形式获得来自谷歌联系人数据:解析谷歌联系人API XML

<entry gd:etag='&quot;Q3Y4fDVSLyt7I2A9WhJXFEkDTgY.&quot;'><id>http://www.google.com/m8/feeds/contacts/email/base/24fc18e00ee1c72e</id><updated>2012-08-08T18:18:42.834Z</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2012-08-08T18:18:42.834Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact'/><title>Person 1</title><link rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/*' href='https://www.google.com/m8/feeds/photos/media/email/24fc18e00ee1c72e'/><link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/email/full/24fc18e00ee1c72e'/><link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/email/full/24fc18e00ee1c72e'/><gd:name><gd:fullName>Person 1</gd:fullName><gd:givenName>Person</gd:givenName><gd:familyName>1</gd:familyName></gd:name><gd:email rel='http://schemas.google.com/g/2005#home' address='[email protected]' primary='true'/><gContact:groupMembershipInfo deleted='false' href='http://www.google.com/m8/feeds/groups/email/base/6'/></entry><entry gd:etag='&quot;R30zcTVSLyt7I2A9WhJXFEkDTgc.&quot;'><id>http://www.google.com/m8/feeds/contacts/email/base/2c7cd0de89c805cc</id><updated>2012-08-08T18:18:56.389Z</updated><app:edited xmlns:app='http://www.w3.org/2007/app'>2012-08-08T18:18:56.389Z</app:edited><category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/contact/2008#contact'/><title>Person 2</title><link rel='http://schemas.google.com/contacts/2008/rel#photo' type='image/*' href='https://www.google.com/m8/feeds/photos/media/email/2c7cd0de89c805cc'/><link rel='self' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/email/full/2c7cd0de89c805cc'/><link rel='edit' type='application/atom+xml' href='https://www.google.com/m8/feeds/contacts/email/full/2c7cd0de89c805cc'/><gd:name><gd:fullName>Person 2</gd:fullName><gd:givenName>Person</gd:givenName><gd:familyName>2</gd:familyName></gd:name><gd:email rel='http://schemas.google.com/g/2005#home' address='[email protected]' primary='true'/><gContact:groupMembershipInfo deleted='false' href='http://www.google.com/m8/feeds/groups/email/base/6'/></entry> 

我将如何使用的DOMDocument解析这个XML在PHP中返回一个不错的阵列其中每个条目将包含该人的标题,姓名和电子邮件?

我迷失了哪些文档方法适合在这种情况下使用。

回答