I am reading xml with this code.
我正在使用此代码阅读xml。
$xml = simplexml_load_string($data);
it reads correctly, and can access to data via $xml->title etc. but i need to access to CDATA and <media:xxx>
tags.
它读取正确,并可以通过$ xml-> title等访问数据,但我需要访问CDATA和
example of xml: pastie from: http://www.metacafe.com/api/item/4779040/
xml:pastie的示例来自:http://www.metacafe.com/api/item/4779040/
is possible to parse that data? how?
有可能解析这些数据吗?怎么样?
2 个解决方案
#1
2
$xml = simplexml_load_string($data);
$namespacesMeta = $xml->getNamespaces(true);
$mediaXML = $xml->children($namespacesMeta['media']);
#2
1
You need to look into SimpleXml and Namespaces
您需要查看SimpleXml和Namespaces
Try this - http://blog.sherifmansour.com/?p=302
试试这个 - http://blog.sherifmansour.com/?p=302
#1
2
$xml = simplexml_load_string($data);
$namespacesMeta = $xml->getNamespaces(true);
$mediaXML = $xml->children($namespacesMeta['media']);
#2
1
You need to look into SimpleXml and Namespaces
您需要查看SimpleXml和Namespaces
Try this - http://blog.sherifmansour.com/?p=302
试试这个 - http://blog.sherifmansour.com/?p=302