Groups | Blog | Home
all groups > dotnet xml > january 2007 >

dotnet xml : There is an error in XML document


Duane
1/1/2007 7:28:40 AM
Okay - I get this error but I cannot tell which node in the XML is
causing the problem. The full error is:
There is an error in XML document (5, 266)
inner exception is:
Input string was not in correct format.

I used xsd.exe on my .xsd file. I have two XML files, one is the full
size of 500Meg and the other is a small sample. The small sample works
perfectly.

My main problem is I cannot tell how to find the error in the big file.

Any help is greatly appreciated.

Thanks!
Martin Honnen
1/1/2007 4:38:54 PM
[quoted text, click to view]

5 should be the line where the error occurs, 266 the position in the line.



--

Martin Honnen --- MVP XML
Keith Patrick
1/2/2007 3:28:20 PM
I'm going to take a wild guess and say that one of your XML nodes is
returning an attribute that has one or more unescaped question marks (or any
of the reserved entities, really, such as &, <, >) and is thus illegally
closing the attribute.

Try (and with your doc size, it could take a while):
System.Diagnostics.Debug.WriteLine(myDoc.OuterXml). That will hopefully
dump to your console but with the line breaks. You then want to copy the
first 6 lines & paste it into VS (or any column-counting editor) and scroll
to column 266, line 5. Or, you could read the XML stream, dumping it out as
it reads it. When it breaks, you'll see the last writeable data in the
console.


AddThis Social Bookmark Button