title: Does org.dom4j.io.SAXReader.read(Reader reader) method preserves the order of elements and attributes of XML
body: <p><strong>My XML file is:</strong></p>
  
  <pre><code>&lt;XYZ&gt;
      &lt;A name="one"&gt;
          &lt;label&gt;I am A one&lt;/label&gt;
      &lt;/A&gt;
      &lt;B name="two"&gt;
          &lt;label&gt;I am B two&lt;/label&gt;
      &lt;/B&gt;
      &lt;A name="three"&gt;
          &lt;label&gt;I am A three&lt;/label&gt;
      &lt;/A&gt;
  &lt;/XYZ&gt;
  </code></pre>
  
  <p><strong>My Code is:</strong></p>
  
  <pre><code>String myXmlAsString = //Read the above xml as String
  Document document = new SAXReader().read(new StringReader(myXmlAsString ));
  List&lt;Element&gt; dataElements = document.selectNodes("/XYZ");
  </code></pre>
  
  <p><strong>My Question is:</strong></p>
  
  <p>If I read my XML file through above mentioned code then does the <code>dataElements</code> List returned by <code>selectNodes(String xPathExpr)</code> method will have the same order as in the original XML file? </p>
  
  <p>If yes, does this holds true even if the XML has deep nesting and I call the <code>selectNodes(String xPathExpr)</code> method on any <code>Element</code> object from this document object.</p>