dev@jaxb.java.net

investigating JAXB issue #665

From: nicolas de loof <nicolas.deloof_at_gmail.com>
Date: Thu, 13 Aug 2009 10:47:51 +0200

Hi,
I just fall into a CXF bug that relies on
https://jaxb.dev.java.net/issues/show_bug.cgi?id=665

The issue is about schema validation for some xsi:type where a namespace
prefix is not recognized.

Looking at ValidatingUnmarshaller.startDocument(), JAXB creates the required
schema validator. This one has it's own NamespaceContext that does not share
prefixes set on the upper-level XML parser, the one that allready parsed the
SOAP headers and xmlns declarations.

I made a hack to check Daniel's testCase : I added this single line in
startDocument to ensure the validator namespaceContext shares the top-level
allready parsed namespaceContext :

 validator.startPrefixMapping( "ser", nsContext.getNamespaceURI( "ser" ) );

The testcase then pass.

For a real-world fix I'd have to iterate on NamespaceContext prefixes, but
this interface doesn't provide an iterator :(. Even casting to concrete
implementation (woodstox Stax parser used by CXF : InputElementStack)
doesn't solve this requirement as actives nameSpace ar private with no
iterator method.

Any suggestion ?
Nicolas