jaxb-ri
jaxb-ri copied to clipboard
DTD namespace is all-or-nothing
Given the following DTD:
%signature.dtd;
And the included signature.dtd:
And the sample XML:
xjc produces code that fails to unmarshall the above XML, reporting that it expects to find a root TEST with namespace URI "http://www.w3.org/2000/09/xmldsig#"
Removing the xmlns attribute from the Signature element (in signature.dtd) results in code that will marshall and unmarshall without error, but also has the effect of stripping the xmlns attribute from the Signature element, which breaks signature verification.
Environment
Operating System: All Platform: All
Affected Versions
[JWSDP1.6 (JAXB1.0.5)]
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/253
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
@glassfishrobot Commented Reported by rshan
@glassfishrobot Commented kohsuke said: DTD and namespaces really don't work well, so I think some kind of heuristic like what XJC does today is needed.
Do you have some suggestions as to how to make this work?
One dumb approach is to let you specify what element is supposed to be in what namespace, maybe in a property file or something.
@glassfishrobot Commented rshan said: How about allowing disablement of dtd namespace support so that 'xmlns' is simply treated as an attribute?
@glassfishrobot Commented kohsuke said: That requires the runtime to be aware of such mode, as well as some annotations to communicate to the runtime that these classes are supposed to be namespace-unaware.
No, that's not going to work. It's just too expensive.
@glassfishrobot Commented kohsuke said: Reclassifying as this is an enhancement request.
@glassfishrobot Commented Was assigned to jaxb-issues
@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-253