本文介绍了如何在QueryPath中获取自定义或命名空间元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在QueryPath库中获取我的自定义元素。但是QueryPath不起作用。谁能帮我在QueryPath中做到这一点吗?参见下面的示例代码;

I'm trying to fetch my custom elements in QueryPath library. But QueryPath does not work. Can anyone please help me how I can do it in QueryPath? See sample code below;

<plugin:text path="filename" />

此外,我还详细检查了PhpSimpleDom库。虽然对我有用。但是它不提供css选择器等的全部支持。我在PhpSimpleDom中也遇到了非常糟糕的内存问题。

Moreover, I also checked the PhpSimpleDom library in detail. Although it works good for me. But it does not provide the full support of css selectors and more. I also have face a very bad memory problem in PhpSimpleDom.

有人可以帮助我在QueryPath中获取上述元素吗?

Can anyone please help me to fetch above mentioned element in QueryPath?

感谢
Smac

ThanksSmac

推荐答案

来自:

rdf:

<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等价冒号。)

这篇关于如何在QueryPath中获取自定义或命名空间元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 13:39