Retrieve a node value from xml

nimish jain

I want to get the value of a node <abc> from xmldata column.

XML data looks like:

<data id="d4E8121C9636942F18AC77F3EECD13ABA">
    <d id="pDF21A1781B684FAD8D476BF14F78D52D">
        <abc>ABC</abc>
    </d> 
</data>

Here is the code:

using (var exampleSource = new ExampleDataSource())
{
    var xmlData = exampleSource.queue
        .Where(a => a.QueueID == queueID)
        .Select(a => a.XMLData)
        .FirstOrDefault();

    var messages = from m in xmlData 
                   select XElement.Parse("abc");
}
Charles Mager

As you've said XMLData is a string, you need to parse this and then get the value of abc like so:

var abc = (string)XElement.Parse(xmlData).Descendants("abc").Single();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Retrieve a value from the first node in an XML::Nodeset using Crystal

From Dev

Retrieve a value from the first node in an XML::Nodeset using Crystal

From Dev

c++ How to retrieve a text value from an XML node

From Dev

Retrieve value from XML directly

From Dev

Retrieve nodes from XML belonging to a specific node

From Dev

Retrieve Value from XML through javascript

From Dev

how to retrieve unique value from xml

From Dev

extracting value from xml node

From Dev

Getting node value from XML

From Dev

Parse XML : retrieve value of a node where @name=RelativePath

From Dev

using xpath to retrieve one node from a xml file

From Dev

Shell script to retrieve node NAME from XML file

From Dev

LINQ XML - Retrieve unknown name and value from XElement

From Dev

Mockito: How to mock XML Document object to retrieve value from XPath

From Dev

How to retrieve specific value from XML document in Windows Phone

From Dev

How to retrieve value from xml file using XMLDog

From Dev

Get Node value from a XML using xmllint

From Dev

XML - extracting value from specific node

From Dev

Get XML Child Node Value from soapxml

From Dev

XML Get Value from Node C#

From Dev

Get Node value from a XML using xmllint

From Dev

Get the Max Value of List Node From XML

From Dev

Parsing XML node and substring from value

From Dev

Extract value from a particular xml node

From Dev

How to retrieve a <img> into a xml node?

From Dev

How to retrieve a <img> into a xml node?

From Dev

Delete node from xml using xslt based on node value

From Dev

Retrieve value from a LinkedHashMap

From Dev

Retrieve value from the Object