2015-02-24 43 views
1

我正試圖在QueryPath庫中獲取我的自定義元素。但是QueryPath不起作用。任何人都可以請幫我在QueryPath中如何做到這一點?見下面的示例代碼;如何在QueryPath中獲取自定義或命名空間的元素?

<plugin:text path="filename" /> 

此外,我還詳細檢查了PhpSimpleDom庫。雖然它對我有好處。但它不提供css選擇器等的全面支持。我也在PhpSimpleDom中遇到了一個非常糟糕的內存問題。

任何人都可以請幫助我在QueryPath中獲取上面提到的元素?

感謝 的Smac

回答

0

https://github.com/pode/reiseplanlegger/blob/master/api/dbpedia.php

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當量)

相關問題