Hi all ,
i want to create XML like below using XmlTextWriter and also want to read using XmlTextReader in my C# application.
plsease help me to create and read this. :)
thanks in advance :)
Hi all ,
i want to create XML like below using XmlTextWriter and also want to read using XmlTextReader in my C# application.
plsease help me to create and read this. :)
thanks in advance :)
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jan 4, 2013, 6:39 AM
VulpesPosted Jan 7, 2013, 9:06 AM
Sumit KumawatPosted Jan 7, 2013, 12:04 AM
thanks for your reply.But my requirement is adding new details in Car and bike node and i also want to maintain my previous details. i used XDocument for this but i was not able to read both node from XDocument.
i want like below XML structure
when first time my XML created :-
now if i added new data in my XML it should be look like this
now i also want to read .
thanx
VulpesPosted Jan 5, 2013, 6:04 AM
This is because it can only work in a forward direction and, so to insert a node, you'd have to rewrite the whole document, including the inserted node, back to the file which is clearly impractical.
However, inserting nodes is very easy with LINQ to SQL which can manipulate the document in memory before writing it back to the file.
Suppose you wanted to add a CC child node to your CAR node. Here's how you'd do it:
Sumit KumawatPosted Jan 4, 2013, 11:34 PM
Thnaks for your reply its working as i wanted. :)
but now i have one more doubt if i want one more node in existing XML then how can i add using XmlTextWriter.