troubleshooting Question

XmlTextReader - xml element order problem

Avatar of fmi2006
fmi2006 asked on
Visual Basic.NET
3 Comments1 Solution420 ViewsLast Modified:
I'm using XmlTextReader and XmlTextWriter (Visual Studio 2005) to parse a big xml file.
What I need to do is:
read each element of the file,
for each element check some conditions in order to leave the element I'm reading unchanged or remove it;
to leave the element unchanged, I write it to another xml file (using XmlTextWriter),
to remove it, I do not write it to the new file.
Everything is ok, but I noticed that sometimes XmlTextReader change the original order of the elements: it appens quite often when there are empty elements nested into other elements.
How can I control XmlTextReader in order to get the right sequence? Do I need to create my own MyXmlTextReader? How can I do this?
Thank you,


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros