简体   繁体   English

System.Xml.Linq.XElement'不包含'XPathEvaluate的定义

[英]System.Xml.Linq.XElement' does not contain a definition for 'XPathEvaluate

I'm trying to query an Xelement value passed in through model data and I'm getting the following error 我正在尝试查询通过模型数据传递的Xelement值,但出现以下错误

var hello1 = (string)this.Model.hello.XPathEvaluate("/hello/helloworld]");

Namespaces in web.config: web.config中的命名空间:

<namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="System.Xml.Linq" />
    <add namespace="System.Xml.XPath"/>
</namespaces>

I ended up removing the references from the config file and added it it directly to the page, @using System.Xml.Linq; 我最终从配置文件中删除了引用,并将其直接添加到页面中,@ using System.Xml.Linq;。 @using System.Xml.XPath; @using System.Xml.XPath;

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 数据绑定:“ System.Xml.linq.XElement”不包含名称为“ colorName”的属性 - DataBinding: 'System.Xml.linq.XElement' does not contain a property with the name 'colorName' System.Xml.Linq.XElement中的查询元素 - Query elements in System.Xml.Linq.XElement 生成UWP时,System.Xml.Linq.XElement没有Load方法 - System.Xml.Linq.XElement does not have Load method when building UWP 扩展System.Xml.Linq.XElement-内部CloneNode - Extending System.Xml.Linq.XElement - internal CloneNode 如何使用XmlWriter将System.Xml.Linq.XElement写入流 - How to write System.Xml.Linq.XElement using XmlWriter to a stream 如何反序列化 System.Xml.Linq.XElement? - How I can deserialize a System.Xml.Linq.XElement? VS2010将System.Xml.XmlElement与System.Xml.Linq.XElement混淆? - VS2010 confuses System.Xml.XmlElement with System.Xml.Linq.XElement? Web服务:无法将类型&#39;System.Xml.Linq.XElement&#39;隐式转换为&#39;System.Xml.XmlElement&#39; - Webservices : Cannot implicitly convert type 'System.Xml.Linq.XElement' to 'System.Xml.XmlElement' Linq强制转换Xelement错误:无法将类型为'System.Xml.Linq.XElement'的对象强制转换为'System.IConvertible' - Linq cast conversion Xelement error: Unable to cast object of type 'System.Xml.Linq.XElement' to type 'System.IConvertible' 将xml字符串传递给System.Xml.Linq.XElement时,避免使用尖括号将xml转义 - Avoid xml escaping of angle brackets, when passing xml string to System.Xml.Linq.XElement
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM