title: StaX: Content not allowed in prolog
body: <p>I have the following (test) XML file below and Java code that uses StaX. I want to apply this code to a file that is about 30 GB large but with fairly small elements, so I thought StaX is a good choice. I am getting the following error: </p>
  
  <p>Exception in thread "main" javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1] Message: Content is not allowed in prolog
      at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:598)
      at at.tuwien.mucke.util.xml.staxtest.StaXTest.main(StaXTest.java:18)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;catalog&gt;
     &lt;book id="bk101"&gt;
        &lt;author&gt;Gambardella, Matthew&lt;/author&gt;
        &lt;title&gt;XML Developer's Guide&lt;/title&gt;
        &lt;price&gt;44.95&lt;/price&gt;
        &lt;description&gt;An in-depth look at creating applications 
         with XML.&lt;/description&gt;
     &lt;/book&gt;
     &lt;book id="bk102"&gt;
        &lt;author&gt;Ralls, Kim&lt;/author&gt;
        &lt;title&gt;Midnight Rain&lt;/title&gt;
        &lt;price&gt;5.95&lt;/price&gt;
        &lt;description&gt;A former architect battles corporate zombies, 
         an evil sorceress, and her own childhood to become queen 
         of the world.&lt;/description&gt;
      &lt;/book&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>Here the code:</p>
  
  <pre><code>package xml.staxtest;
  
  import java.io.*;
  import javax.xml.stream.*;
  
  public class StaXTest {
  
  public static void main(String[] args) throws Exception  {
  
      XMLInputFactory xif = XMLInputFactory.newInstance();
      XMLStreamReader streamReader = xif.createXMLStreamReader(new FileReader("D:/Data/testFile.xml"));
  
      while(streamReader.hasNext()){
          int eventType = streamReader.next();
  
          if(eventType == XMLStreamReader.START_ELEMENT){
              System.out.println(streamReader.getLocalName());
          }
  
          //... more to come here later ...
      }
  }
  </code></pre>
  
  <p>}</p>