Odi's astoundingly incomplete notes
New entries | CodeFixing a JDOM design flaw
The problem was simple: Create an XML document and validate it against a given schema before sending it to the customer.
The solution seemed simple:
It boiled down to the problem that JDOM's DOMOutputter tried to be clever and created nodes without namespace support if the node was in no namespace. I addressed this by patching this class a little, so it gives you more control over this behaviour. Now it works. I hope that the JDOM people will include the patch in their next release.
Update: the patch has been included into the jdom-1.1 release
The solution seemed simple:
- Use JDOM to create a document model in memory.
- Use DOMOutputter to convert it to a W3C DOM
- Validate the DOM against an XML schema using Xerces through JAXP
It boiled down to the problem that JDOM's DOMOutputter tried to be clever and created nodes without namespace support if the node was in no namespace. I addressed this by patching this class a little, so it gives you more control over this behaviour. Now it works. I hope that the JDOM people will include the patch in their next release.
Update: the patch has been included into the jdom-1.1 release
Add comment