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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jan 4, 2013, 1:39 AM EST
Sumit KumawatRank #4,008 · 372 reputationPosted Jan 4, 2013, 6:34 PM EST
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.
VulpesRank #55 · 29.2K reputationPosted Jan 5, 2013, 1:04 AM EST
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 KumawatRank #4,008 · 372 reputationPosted Jan 6, 2013, 7:04 PM EST
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
VulpesRank #55 · 29.2K reputationPosted Jan 7, 2013, 4:06 AM EST