title: VBScript and loadXML: Invalid at the top level of the document. How to fix it?
body: <p>This is my fort post on stackoverflow. I have searched many similiar Q&amp;A's on this site but my conditions seem a bit different. here is my vbscript code:</p>
  
  <p>------------ code snippet ---------------</p>
  
  <pre><code>xmlurl = "songs.xml"
  
  set xmlDoc = CreateObject("Microsoft.XMLDOM")
  xmlDoc.async = False
  xmlDoc.loadXML(xmlurl)
  
  if xmlDoc.parseError.errorcode&lt;&gt;0 then
    'error handling code
    msgbox("error! " &amp; xmlDoc.parseError.reason)
  end if
  </code></pre>
  
  <p>------------ end code snippet ---------------</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;nowplaying-info-list&gt;
    &lt;nowplaying-info mountName="CKOIFMAAC" timestamp="1339771946" type="track"&gt;
      &lt;property name="track_artist_name"&gt;&lt;![CDATA[CKOI]]&gt;&lt;/property&gt;
      &lt;property name="cue_title"&gt;&lt;![CDATA[HITMIX]]&gt;&lt;/property&gt;
    &lt;/nowplaying-info&gt;
    &lt;nowplaying-info mountName="CKOIFMAAC" timestamp="1339771364" type="track"&gt;
      &lt;property name="track_artist_name"&gt;&lt;![CDATA[AMYLIE]]&gt;&lt;/property&gt;
      &lt;property name="cue_title"&gt;&lt;![CDATA[LES FILLES]]&gt;&lt;/property&gt;
    &lt;/nowplaying-info&gt;
    &lt;nowplaying-info mountName="CKOIFMAAC" timestamp="1339771149" type="track"&gt;
      &lt;property name="track_artist_name"&gt;&lt;![CDATA[MIA MARTINA]]&gt;&lt;/property&gt;
      &lt;property name="cue_title"&gt;&lt;![CDATA[TOI ET MOI]]&gt;&lt;/property&gt;
    &lt;/nowplaying-info&gt;
  &lt;/nowplaying-info-list&gt;
  </code></pre>
  
  <p>I also tried removing the first line in case maybe UTF-8 was not compatible with windows (saw some posts about this), but I still got the same error. I also tried unix2dos and vice versa in case there were carriage return issues (hidden characters embedded in the xml). I just can't seem to figure out what's wrong. It's such a simole XML file. I could parse it in a few minutes using perl regex but I need to run this script on windows so using vbscript. I use the same technique to parse XML from other sources without any issues. I cannot modify the XML unfortunately, it is from an external source.
  I have this exact same error on both my Windows Vista home edition and Windows Server 2008. I am running the vbscript from the command line for testing so far (ie not in ASP).</p>
  
  <p>Thanks in advance,</p>
  
  <p>Sam</p>