|
-
May 15th, 2012, 09:17 AM
#1
Read Nested XML
Ok... here is my problem...
I want to read what is inside of a tag even if it is another tag... but I just cannot seem to figure it out!
My XML is :
<doc>
<page><title>Hi</title></page>
</doc>
How do I get what is inside the page tag? (the return should be "title>Hi</title>") but so far I cannot get that!
Right now I'm using the XmlTextReader to read the file and then switch the NodeTypes to find the Elements/Text/EndElements...
But Elements returns the Elements, and the Text return what is inside the inner most Element! NOT the particular element.
I think the problem is that it reads the XML line by line rather than whole and then process...
Any help is appreciated.
-
May 17th, 2012, 08:33 AM
#2
Re: Read Nested XML
1. Find the XmlNode corresponding to <page> (i.e., by accessing the first child of the root node)
2. Print the InnerXml / OuterXml properties of this node: http://msdn.microsoft.com/en-us/libr....innerxml.aspx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|