[jdom-interest] DOMOutputter and namespace aware Documents
Ortwin Glück
odi at odi.ch
Tue May 23 02:09:18 PDT 2006
Hi,
Is there a way to make DOMOutputter create a namespace aware DOM? I need
this so I can schema validate it. I am using Xerces 2.6 via JAXP. See
comments in this issue report for explanations:
http://issues.apache.org/jira/browse/XERCESJ-1163?page=all
The problem is that my JDOM elements are in NO_NAMESPACE. And the
validation uses a noNamespaceSchemaLocation. That's perfectly legal.
But with elements not in a namespace I get a DOM without namespace
support! This prevent schema validation.
See line 251 in DOMOutputter:
if (element.getNamespace() == Namespace.NO_NAMESPACE) {
// No namespace, use createElement
domElement =
domDoc.createElement(element.getQualifiedName());
}
else {
domElement = domDoc.createElementNS(
element.getNamespaceURI(),
element.getQualifiedName());
}
There should be a way to tell DOMOutputter to call createElementNS even
if I use NO_NAMESPACE.
Any hint would be greatly appreciated.
Ortwin
More information about the jdom-interest
mailing list