String namespaces = "http://xml.org/sax/features/namespaces";
xmlReader.setFeature(namespaces, namespaceAware);
// Use the appropriate DOM builder based on "namespaceAware"
if (namespaceAware) {
builder = new XmlDocumentBuilderNS();
} else {
builder = new XmlDocumentBuilder();
}
// Use builder as the ContentHandler