title: Bizarre Spark/Scala XML error?
body: <p>I'm loading an XML file from S3 with this command:</p>
  
  <pre><code>val metadata = XML.loadString(sc.textFile("s3://mybucket/metadata.xml").fold("")((s1, s2) =&gt; s1 + "" + s2))
  </code></pre>
  
  <p>The first time I run the command, it fails with exception:</p>
  
  <pre><code>org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 39; The markup in the document following the root element must be well-formed.
  </code></pre>
  
  <p>The second time I run the command, it works!  What gives?</p>
  
  <p>Here's the XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!--Sample XML file generated by XMLSpy v2015 rel. 3 (x64)     (http://www.altova.com)--&gt;
  &lt;session xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="KioskAnalyticsSchemaPromoCodesArray.xsd"&gt;
    &lt;kioskID&gt;String&lt;/kioskID&gt;
    &lt;sessionId&gt;String&lt;/sessionId&gt;
    &lt;sessionStart&gt;String&lt;/sessionStart&gt;
    &lt;promoCodes&gt;
      &lt;promoCode code="String" valid="String" value="String" serverFailureReason="String" online="String"/&gt;
      &lt;promoCode code="String" valid="String" value="String" serverFailureReason="String" online="String"/&gt;
    &lt;/promoCodes&gt;
  &lt;/session&gt;
  </code></pre>