title: java StAX parser: not preserving double quotes for attributes
body: <p>StAX parser is converting the <strong>double quotes</strong> around attributes to <strong>single quotes</strong> in the data model used by <code>XMLEventReader</code>. This is fine, but If I want to print back the XML, perhaps selecting only a fragment of the original XML, the output will not be the same.</p>
  <p>Input file:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;root&gt;
    &lt;mySubTrees&gt;
      &lt;mySubTree&gt;
        &lt;a property=&quot;target&quot;&gt;
          &lt;aa&gt;123&lt;/aa&gt;
        &lt;/a&gt;
        &lt;b&gt;456&lt;/b&gt;
        &lt;c&gt;789&lt;/c&gt;
      &lt;/mySubTree&gt;
    &lt;/mySubTrees&gt;
  &lt;/root&gt;
  </code></pre>
  <p>Code:</p>
  <pre class="lang-java prettyprint-override"><code>@Test
  public void test_getXmlFragment() throws Exception {
    byte[] fileContent = getXMLBytes();
    String xmlFragment = &quot;&quot;;
  
    XMLInputFactory factory = XMLInputFactory.newInstance();
    XMLEventReader eventReader = factory.createXMLEventReader(new ByteArrayInputStream(fileContent));
    while (eventReader.hasNext()) {
      XMLEvent event = eventReader.nextEvent();
      xmlFragment += event;
    }
  
    System.out.println(xmlFragment);
  }
  
  private byte[] getXMLBytes() throws IOException {
    InputStream inputStream = this.getClass().getResource(PREFIX_XML_FILES + &quot;/sss.xml&quot;).openStream();
    byte[] fileContent = new byte[inputStream.available()];
    inputStream.read(fileContent);
    inputStream.close();
    return fileContent;
  }
  </code></pre>
  <p>Output:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;null&quot; encoding='UTF-8' standalone='no'?&gt;
  &lt;root&gt;
      &lt;mySubTrees&gt;
          &lt;mySubTree&gt;
              &lt;a property='target'&gt;
                  &lt;aa&gt;123&lt;/aa&gt;
              &lt;/a&gt;
              &lt;b&gt;456&lt;/b&gt;
              &lt;c&gt;789&lt;/c&gt;
          &lt;/mySubTree&gt;
      &lt;/mySubTrees&gt;
  &lt;/root&gt;
  </code></pre>
  <p>Desired Output:</p>
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version=&quot;null&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;
  &lt;root&gt;
      &lt;mySubTrees&gt;
          &lt;mySubTree&gt;
              &lt;a property=&quot;target&quot;&gt;
                  &lt;aa&gt;123&lt;/aa&gt;
              &lt;/a&gt;
              &lt;b&gt;456&lt;/b&gt;
              &lt;c&gt;789&lt;/c&gt;
          &lt;/mySubTree&gt;
      &lt;/mySubTrees&gt;
  &lt;/root&gt;
  </code></pre>
  <p>Is there any way how to fine-tune this?</p>