[英]HtmlAgilityPack Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function
I am using HtmlAgilityPack and i am facing this error 我正在使用HtmlAgilityPack,并且遇到此错误
Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.
using this code 使用此代码
Document.LoadHtml(textBox1.Text);
var result = Document.DocumentNode.SelectNodes("id('side_info')/x:div[2]/x:a/x:span");
textBox1.Text = result.ToString();
[NOTE] i am using XPath Checker add on for Firefox and it tells that the namespace x is at uri http://www.w3.org/1999/xhtml/ [注意]我正在为Firefox使用XPath Checker插件,它告诉命名空间x位于uri http://www.w3.org/1999/xhtml/
But i cant add the name space to the HtmlAgilityPack SelectNodes 但是我无法将名称空间添加到HtmlAgilityPack SelectNodes
好的,我用SelectSingleNode和XSLTContext解决了这个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.