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?