title: Are there any disadvantages to setNamespaceAware(true)?
body: <p>I was parsing an XML document, in Java, using the following code:</p>
  
  <pre><code>DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
  DocumentBuilder db = dbf.newDocumentBuilder();
  Element el = db.parse(file).getDocumentElement();
  </code></pre>
  
  <p>However, when parsing an XML document that uses namespaces, I get the error:</p>
  
  <pre><code>org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create
  or change an object in a way which is incorrect with regard to namespaces.
          at org.apache.xerces.dom.ElementNSImpl.setName(Unknown Source)
  </code></pre>
  
  <p>I solved this error by adding the line:</p>
  
  <pre><code>dbf.setNamespaceAware(true);
  </code></pre>
  
  <p>Now everything works.</p>
  
  <p>It would seem to me that setting the parser to be namespace-aware would be a purely positive thing. As far as I understand, it can still handle "vanilla" non-namespace documents just fine, without any disadvantages.</p>
  
  <p>But yet, if that were the case, then why did they make it an option, and why <code>false</code> by default?</p>
  
  <p>So my question is: What is a good default for me to use in my software? Should I always set it to <code>true</code> (because the designers of these APIs messed up by offering it as an option at all) or should I leave it as <code>false</code> in some cases because each value has some advantages? If so, what are the advantages of <code>false</code>?</p>