title: StAX well-formedness check of XML
body: <p>I am checking an XML document for well formedness (only syntax check). I am not validating against any schema.
  I need to do this using StAX:</p>
  
  <p>I do know that I have to parse the file, but how do I implement the check?</p>
  
  <pre><code>XMLInputFactory factory = XMLInputFactory.newInstance(); 
  File f = new File(uploadfileName);
  FileInputStream inputStream = new FileInputStream(f); 
  //Instantiate a reader parsing:
  XMLStreamReader reader=factory.createXMLStreamReader(inputStream);
  
          while(reader.hasNext()){
              //check to be implemented??
              reader.next();
          }
  </code></pre>