To use XPath with LINQ to XML add a using declaration for System.Xml.XPath
, this will bring the extension methods of System.Xml.XPath.Extensions
into scope.
In your example:
var value = (string)xml.XPathEvaluate("/response/data/hash");
More Related Contents:
- Can I use a Regex in an XPath expression?
- Best way to get InnerXml of an XElement?
- how to use XPath with XDocument?
- How to read large xml file without loading it in memory and using XElement
- How to prevent XPath/XML injection in .NET
- Performance: XDocument versus XmlDocument
- XPath and XSLT 2.0 for .NET? [closed]
- Does XSLT have a Split() function?
- XML – Data At Root Level is Invalid
- Simplest way to have a configuration file in a Windows Forms C# application
- Query an XDocument for elements by name at any depth
- XmlSerializer: remove unnecessary xsi and xsd namespaces
- Deserializing empty xml attribute value into nullable int property using XmlSerializer
- Get the XPath to an XElement?
- Best way to encode text data for XML
- What is the difference between Linq to XML Descendants and Elements
- What is the correct format to use for Date/Time in an XML file
- get line number for XElement here
- Ignore namespaces in LINQ to XML
- How to solve “unable to switch the encoding” error when inserting XML into SQL Server
- XmlTextReader vs. XDocument
- Does .Net 4.5 support XML 1.1 yet (for characters invalid in XML 1.0)?
- Why “Data at the root level is invalid. Line 1, position 1.” for XML Document?
- “Type not expected”, using DataContractSerializer – but it’s just a simple class, no funny stuff?
- Can I serialize Anonymous Types as xml?
- How do I specify XML serialization attributes to support namespace prefixes during deserialization in .NET?
- Finding element in XDocument?
- How can I remove empty xmlns attribute from node created by XElement
- Using .Net what limitations (if any) are there in using the XmlSerializer?
- Serializing a list of Key/Value pairs to XML