title: ClassCastException reading XML file
body: <p>I have the following xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;  
  &lt;c1&gt;
   &lt;c2 id="0001" n="CM" urlget="/at/CsM" urle="/E/login.jsp"&gt;
   &lt;/c2&gt;
   &lt;c2 id="0002" n="C2M" urlget="/a2t/CsM" urle="/E2/login.jsp"&gt;
   &lt;/c2&gt;
  &lt;/c1&gt; 
  </code></pre>
  
  <p>I'm trying to load c2's attributes this way:</p>
  
  <pre><code>Document d =
   DocumentBuilderFactory.newInstance()
   .newDocumentBuilder()
   .parse("epxy.xml");
  Element  c1 = d.getDocumentElement();
  Element c2 = (Element)c1.getFirstChild();
  while (c2 != null) {
    ...         
    c2 = (Element)c2.getNextSibling();
  }
  </code></pre>
  
  <p>But I get the exception <strong>java.lang.ClassCastException: org.apache.xerces.dom.DeferredTextImpl incompatible with org.w3c.dom.Element</strong>
  in the line</p>
  
  <pre><code>Element c2 = (Element)c1.getFirstChild();
  </code></pre>
  
  <p>before the loop.</p>
  
  <p>Any hints ? Thanks.</p>