Note that there are some explanatory texts on larger screens.

plurals
  1. POData at the root level is invalid. Line 1, position 1. while reading xml
    text
    copied!<p>when i try to read an xml file from a third party company, i get the error:</p> <pre><code>Data at the root level is invalid. Line 1, position 1. </code></pre> <p>i've read on google the problem could be because the data of the xml document is utf-8 and String only accepts utf-16.</p> <p>but i can't find a proper solution. I read the xml file from an url.</p> <p>this is the code i wrote:</p> <pre><code>private void GetBlockList(DateTime lastUpdate, string username, string password) { List&lt;String&gt; m_list = new List&lt;String&gt;(); HttpWebRequest blockListRequest = (HttpWebRequest)WebRequest.Create(string.Format("https://www.apiemail.net/api.aspx?Username={0}&amp;Password={1}&amp;Function=get_blocklist&amp;SID=4", username, password)); HttpWebResponse blockListResponse = (HttpWebResponse)blockListRequest.GetResponse(); XmlDocument blockListXmlDoc = new XmlDocument(); XmlNode root = blockListXmlDoc.DocumentElement; XmlNodeList blockNodeList = root.SelectNodes("blockedemail"); blockListXmlDoc.Load(blockListResponse.GetResponseStream()); int count = 0; while (blockNodeList.Count &lt; count) { m_list.Add(blockNodeList.Item(count).SelectSingleNode("address").InnerText); count++; } return m_list; } </code></pre> <p>first few lines op xml: (note it's a quite large xml.)</p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;blockedemails&gt; &lt;blockedemail&gt; &lt;address&gt;email&lt;/address&gt; &lt;date&gt;6/4/2011 12:11:14 AM&lt;/date&gt; &lt;/blockedemail&gt; &lt;blockedemail&gt; &lt;address&gt;email&lt;/address&gt; &lt;date&gt;6/6/2011 1:39:04 PM&lt;/date&gt; &lt;/blockedemail&gt; &lt;blockedemail&gt; &lt;address&gt;email&lt;/address&gt; &lt;date&gt;4/23/2011 8:56:06 PM&lt;/date&gt; &lt;/blockedemail&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload