EDN Admin
Well-known member
<span style="font-family:"Calibri","sans-serif"; font-size:11pt The error message I get is: "Data at the root level is invalid. Line 1, position 1"
<span style="font-family:"Calibri","sans-serif"; font-size:11pt Now typically, this is cause because their is garbage in the xml itself such as non-printable chaaracters or messed up syntax (missing closing tag etc), but not in my case.
<span style="font-family:"Calibri","sans-serif"; font-size:11pt There is a process which runs through about 100 or more records that are read from one system. For each record, it reads the xml string into a reader, then loads this reader into an xml
document. The code is doing this
<span style="font-family:"Calibri","sans-serif"; font-size:11pt <span style="font-size:x-small <font size="2" style="font-size:x-small
</font><span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small XmlReader<span style="font-size:x-small reader =
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small XmlReader<span style="font-size:x-small .Create(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small new<span style="font-size:x-small
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small StringReader<font size="2 (response));<br/>
retDoc.Load(reader);</font>
<span style="font-family:"Calibri","sans-serif"; font-size:11pt Where retDoc is an xmldocument and response is an xml string.
<span style="font-family:"Calibri","sans-serif"; font-size:11pt For some strange reason, and what seems to be at random times, this fails and the error I get is
<br/>
"Data at the root level is invalid. Line 1, position 1"
<span style="font-family:"Calibri","sans-serif"; font-size:11pt My error handling is catching this and when it happens, I save off the xml string and attach to an email along with the stack trace.<br/>
At first I was suspecting the xml was messed up, but this is not the case, as I can load it in Internet Explorer just fine, it is well formed. What is even more strange, is that I can restart the process and sometimes that clears it up and the problem
does not happen again. Sometimes I have to restart two or three times.
<span style="font-family:"Calibri","sans-serif"; font-size:11pt Any suggestions as to what could be causing this? <hr class="sig 01000100 01100101 01101111 00100000 01010110 01101001 01101110 01100100 01101001 01100011 01100101
View the full article
<span style="font-family:"Calibri","sans-serif"; font-size:11pt Now typically, this is cause because their is garbage in the xml itself such as non-printable chaaracters or messed up syntax (missing closing tag etc), but not in my case.
<span style="font-family:"Calibri","sans-serif"; font-size:11pt There is a process which runs through about 100 or more records that are read from one system. For each record, it reads the xml string into a reader, then loads this reader into an xml
document. The code is doing this
<span style="font-family:"Calibri","sans-serif"; font-size:11pt <span style="font-size:x-small <font size="2" style="font-size:x-small
</font><span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small XmlReader<span style="font-size:x-small reader =
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small XmlReader<span style="font-size:x-small .Create(<span style="color:#0000ff; font-size:x-small <span style="color:#0000ff; font-size:x-small new<span style="font-size:x-small
<span style="color:#2b91af; font-size:x-small <span style="color:#2b91af; font-size:x-small StringReader<font size="2 (response));<br/>
retDoc.Load(reader);</font>
<span style="font-family:"Calibri","sans-serif"; font-size:11pt Where retDoc is an xmldocument and response is an xml string.
<span style="font-family:"Calibri","sans-serif"; font-size:11pt For some strange reason, and what seems to be at random times, this fails and the error I get is
<br/>
"Data at the root level is invalid. Line 1, position 1"
<span style="font-family:"Calibri","sans-serif"; font-size:11pt My error handling is catching this and when it happens, I save off the xml string and attach to an email along with the stack trace.<br/>
At first I was suspecting the xml was messed up, but this is not the case, as I can load it in Internet Explorer just fine, it is well formed. What is even more strange, is that I can restart the process and sometimes that clears it up and the problem
does not happen again. Sometimes I have to restart two or three times.
<span style="font-family:"Calibri","sans-serif"; font-size:11pt Any suggestions as to what could be causing this? <hr class="sig 01000100 01100101 01101111 00100000 01010110 01101001 01101110 01100100 01101001 01100011 01100101
View the full article