libxml 2.8.0 で特定の XPath 式を評価しようとしていますが、関数に関するエラー メッセージが表示されます。libxml が XPath 仕様の全体またはサブセットを実装しているかどうかは、私には明らかではありません。実装されているものとその使用方法を明確に特定するリソースはありますか?
私の特定のケースでは、評価しようとしている 1 つの式は次のとおりです。
/TemporalInformation/RecipeInformation[fn:exists(./ActionToActionRelation[fn:contains(./@actionA,'cook') and fn:exists(./IngredientA[fn:contains(./@classes,'onion')])])]
XML::LibXML Perl モジュールを介して libxml を使用していますが、xmlsoft.org から入手できるサンプルツールを使用して式を試したところ、同じエラー メッセージが表示されました。xpath1.c
$ ./xpath-tester data/fk.xml "/TemporalInformation/RecipeInformation[fn:exists(.> /ActionToActionRelation[fn:contains(./@actionA,'cook') and fn:exists(./IngredientA[fn:contains(./@classes,'onion')])])]" "fn=http://www.w3.org/2005/xpath-functions"
xmlXPathCompOpEval: function contains not found
XPath error : Unregistered function
xmlXPathCompOpEval: function exists not found
XPath error : Unregistered function
XPath error : Invalid expression
XPath error : Stack usage errror
Error: unable to evaluate xpath expression "/TemporalInformation/RecipeInformation[fn:exists(./ActionToActionRelation[fn:contains(./@actionA,'cook') and fn:exists(./IngredientA[fn:contains(./@classes,'onion')])])]"
Usage: ./xpath-tester <xml-file> <xpath-expr> [<known-ns-list>]
where <known-ns-list> is a list of known namespaces
in "<prefix1>=<href1> <prefix2>=href2> ..." format
fn
名前空間の有無にかかわらずxpath.c
、Perl スクリプトの有無にかかわらず試してみましたが、同じ結果が得られました。