Re: XMLTextReader reading too many characters

Tech-Archive recommends: Fix windows errors by optimizing your registry



JohnB wrote:

I don't know for certain if it was your intention, but the tone of your message is hostile. I am not wasting your time. I had presumed that you had the knowledge of how to delete a tag from an XML document, though perhaps I over estimated your abilities. Maybe a Microsoft MVP XML status isn't indicative of being capable of editing an XML document. Here again is the XML document sample with the offending tag removed.

If you claim there is a problem with XmlTextReader and an allegedly well-formed XML document but then provide an XML sample that is not well-formed then it does not help that I edit the document. You need to provide a sample that allows us to reproduce the problem. I am not able to guess how your sample looks that allegedly has the problem.

With the sample you have no provided I have no problems to read it with XmlReader or XmlTextReader, it parses through the sample without giving the error you claim it produces.

Simple test code is

using (XmlTextReader xmlTextReader = new XmlTextReader(@"test2007080702.xml"))
{
while (xmlTextReader.Read())
{
Console.WriteLine("{0}: {1}.", xmlTextReader.NodeType, xmlTextReader.Name);
}
}

Tested with .NET 2.0.


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.



Relevant Pages

  • Re: XMLTextReader reading too many characters
    ... It was a very simple process to delete the extra tag. ... You do know about XML ... status isn't indicative of being capable of editing an XML document. ... If you claim there is a problem with XmlTextReader and an allegedly ...
    (microsoft.public.dotnet.xml)
  • Reading XML document with blank lines at top
    ... I am trying to read an XML document generated by a web server using the ... XMLTextReader class, but the document generated appears to have some blank ... "The XML declaration is unexpected. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: How Do I parse this XML document, most efficiently?
    ... Correct, I do not want to use XMLDocument Class, there can easily be ... 50,000-80,000 Messages elements in the document. ... If you look at the xml document, I need to get an element that is at the end ... If we use the XMLTextReader, we would have to parse the document twice, this ...
    (microsoft.public.dotnet.xml)
  • Re: Finding/removing nodes with attribute value
    ... I have a rather large xml document that can have one or ... Since you can find these attributes in your XmlTextReader, ... public class NodeStripReader: XmlTextReader ... and you'll observe that the excluded element and it's child nodes, the following tree, ...
    (microsoft.public.dotnet.xml)
  • Re: Reading XML document with blank lines at top
    ... HTTP stream and dumping it, starting with "<?xml", into a temp file which I ... > I am trying to read an XML document generated by a web server using the ... > XMLTextReader class, but the document generated appears to have some blank ... > product which return an XML document. ...
    (microsoft.public.dotnet.languages.vb)