Retrieving xml value into a string
Posted
by
DelvinK
on Stack Overflow
See other posts from Stack Overflow
or by DelvinK
Published on 2010-12-23T14:45:17Z
Indexed on
2010/12/23
14:54 UTC
Read the original article
Hit count: 200
Hello,
In the following XML structure how do i retrieve the name value and put this into a string? (i am using a XPathNavigator in my method)
<testsystem>
<test>
<name>one</name>
</test>
</testsystem>
I was able to get a attribute with a syntax alike this: (but when changing the xml struture it no longer holds a attribute value)
string name = nav.GetAttribute("name", "")
But have no luck getting the value with a nav as of yet.
The purpose is to be able to use it for the following object so i can put name into it.
test t = new test() { Name = name, Questions= new List<Questions>() };
Best regards.
© Stack Overflow or respective owner