我试图在QueryPath库中获取我的自定义元素。但是QueryPath不起作用。谁能帮我在QueryPath上做这件事吗?见下面的示例代码;
<plugin:text path="filename" />此外,我还详细检查了PhpSimpleDom库。虽然这对我有好处。但是它并没有提供css选择器和更多的支持。在PhpSimpleDom中,我也面临着一个非常糟糕的内存问题。
有人能帮我在QueryPath中提取上面提到的元素吗?
谢谢Smac
发布于 2015-02-26 12:57:49
来自https://github.com/pode/reiseplanlegger/blob/master/api/dbpedia.php
卢旺达国防军:
<rdf:RDF><rdf:Description rdf:about="http://dbpedia.org/resource/John_Frandsen_(footballer)"><dbpprop:placeOfBirth rdf:resource="http://dbpedia.org/resource/Denmark"/><dbpedia-owl:birthPlace rdf:resource="http://dbpedia.org/resource/Denmark"/></rdf:Description>/rdf:RDF>代码:
// Fetch the URL and select all rdf:Description elements.
// (Note that | is the CSS 3 equiv of colons for namespacing.)
// To add the context, we pass it in as an option to QueryPath.
$qp = qp($url, 'rdf|Description', array('context' => $cxt));
[...]
// Here, we use rdf|* to select all elements in the RDF namespace.
$qp->top()->find('rdf|about');(注意,CSS 3是命名空间冒号的CSS 3。)。
https://stackoverflow.com/questions/28707105
复制相似问题