title: XMLStreamException: XML version "1.1" is not supported, only XML 1.0 is supported
body: <p>about the XML schema versions and the parsing libraries in java, i understand that the best approach is to use "1.0" instead of "1.1" since not all libraries and environments support it and the benefits are little to none, but facing a situation that XML schema "1.1" "must" be supported, i have the following issue:</p>
  
  <p>In this portion of code:</p>
  
  <pre><code>    XMLInputFactory factory = XMLInputFactory.newInstance();
      XMLEventReader reader = factory.createXMLEventReader(XsltTest.class.getResourceAsStream("/an-xsl-file.xsl"));
  
      String encoding = null;
      if(reader.hasNext()){
          XMLEvent event = reader.nextEvent();
          if(event instanceof StartDocument){
              encoding = ((StartDocument)event).getCharacterEncodingScheme();
          }
      }
  </code></pre>
  
  <p>where "an-xsl-file.xsl" is an XSLT file using XML Schema version "1.1", an XMLStreamException is rasied in when calling reader.nextEvent(), arguing that only XML 1.0 is supported, if i use the same portion of code in an isolated java project (jdk 1.7) with this an nothing else, the snippet works without problem, but when this snippet is run within a particular application with the same JVM it fails the way i mention; this points me to think that there might be dependency issues but i haven't been able to figure out what could it be.</p>
  
  <p>The application is using xml and xslt processing libraries like:</p>
  
  <ul>
  <li>Saxon 9</li>
  <li>Xerces</li>
  <li>Castor XML</li>
  <li>Xalan</li>
  </ul>
  
  <p>Among others, i'm just starting to get familiar with them so i'm not really sure if there could be a conflict within them, are there any known conflict issues with this? or it is just another different thing? am i missing something? could you please share what you know about it?</p>
  
  <p>btw, for now, i just can't use XML version 1.0 mainly because the document is using characters codes only supported in 1.1.</p>
  
  <p>Thank you!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Ok thanks for the comments, i know this could be a very broad question, but to be honest this is the situation i'm facing right now that's why i'm looking for a hint on what could be the problem hence further investigate and improve the information.</p>
  
  <p>This is part of the exception trace:</p>
  
  <pre><code>javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,20]
  Message: XML version "1.1" is not supported, only XML 1.0 is supported.
          at com.sun.xml.stream.XMLReaderImpl.next(XMLReaderImpl.java:508)
          at com.sun.xml.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:62)
          at com.pkg.tofailing.artifact.ClassWithError.getXMLEncoding(ClassWithError.java:216)
  </code></pre>
  
  <p>Where "getXMLEncoding" is the method containing the provided snippet of code, sorry but i might get in trouble if i share more than that, the rest of the stacktrace just contains application classes.</p>
  
  <p>Also, about the xsl file i mention, this is how it starts:</p>
  
  <pre><code>&lt;?xml version="1.1" encoding="UTF-8"?&gt;
  &lt;xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt;
      &lt;xsl:output method="text" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/&gt;
  </code></pre>
  
  <p>The failure occurs just reading the first line, where encounters the 1.1 version of XML, if i change it for 1.0 then another error raises in a posterior line with this content:</p>
  
  <pre><code>&lt;xsl:text&gt;&amp;#12;&amp;#10;&lt;/xsl:text&gt;
  </code></pre>
  
  <p>The character "&#38;#12;" which is unused according to <a href="http://www.w3.org/MarkUp/html-spec/html-spec_13.html" rel="nofollow">www.w3.org</a> is the one making it fail on XML 1.0, however for some reason it has to bee supported and XML 1.1 does it, now the problem is with the XML version.</p>
  
  <p>Hope the context be clearer now.</p>
  
  <p>Thanks again!</p>