Click here to Skip to main content
15,918,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am a beginner . this question might be stupid. but i need help.

XML
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>



how to get the data in the tag "to".
This is in a XDocument
Thank you in advance for the help.

:)
Posted
Updated 6-Apr-13 18:46pm
v2
Comments
Sergey Alexandrovich Kryukov 7-Apr-13 1:05am    
It does not have to be XDocument. It depends on your application...
—SA

C#
foreach (XElement hashElement in doc.Descendants("to"))
                    {
                        string hashValue = (string)hashElement;
                        OutputTextBlock.Text = hashValue;
                    }




Yes i got it.. :P
 
Share this answer
 
Comments
Maciej Los 7-Apr-13 11:38am    
Mark this answer as "solved" (green button).
Hello,

please refer this post from my blog

http://juhi2012.wordpress.com/2012/08/[^]

there is an example of get xmlnode to datatable.
might be it will helpful to you
let me know that.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900