users@jaxb.java.net

Help! ContentHandlerAdaptor.startPrefixMapping called with null prefix!

From: Nick Sayer <nsayer_at_kfu.com>
Date: Tue, 1 Nov 2005 19:07:37 -0800

I actually posted this first to the JAXB 2.0 forum, but I think that
this may be a better place to ask.

I'm using jwsdp-1.6 with a 1.5.0_05 JRE on Linux. I have an <xs:any>
node in my schema I've set up with <xjc:dom/>.

When attempting to marshal the JAXB root to XML (specifically, to a
StringWriter), I wind up getting NPEs from the JAXB derived classes.
The root cause is this stack trace:

at com.sun.xml.bind.unmarshaller.DOMScanner.visit(DOMScanner.java:152)
at com.sun.xml.bind.unmarshaller.DOMScanner.parse(DOMScanner.java:72)
at com.myclasses.impl.AuxXMLDataTypeImpl.serializeBody
(AuxXMLDataTypeImpl.java:38)
at com.myclasses.impl.AuxXMLDataImpl.serializeBody
(AuxXMLDataImpl.java:43)
at com.myclasses.impl.runtime.SAXMarshaller.childAsBody
(SAXMarshaller.java:391)
at com.myclasses.impl.EmailTypeImpl.serializeBody(EmailTypeImpl.java:
708)
at com.myclasses.impl.EmailImpl.serializeBody(EmailImpl.java:43)
at com.myclasses.impl.runtime.SAXMarshaller.childAsBody
(SAXMarshaller.java:391)
at com.myclasses.impl.runtime.MarshallerImpl.write
(MarshallerImpl.java:171)
at com.myclasses.impl.runtime.MarshallerImpl.marshal
(MarshallerImpl.java:144)

At that point, impl.runtime.ContentHandlerAdaptor.startPrefixMapping
is being called with a null prefix.

The root node of the DOM document does indeed have an
xmlns:xxx="http://yaddayadda..." namespace declaration, but obviously
'xxx' is not null in this case.

What kills me is that if I run the exact same code on my mac, it
works just fine.

If I look at the DOM document nodes before attempting to hook them up
to the AuxXMLData JAXB class, they look just fine, including the
namespace declaration attributes.

I would be inclined to think that this is a difference between the
JAXP / DOM / SAX libraries on the two platforms, but I've tried to
fetch the org.apache versions and it hasn't helped any.

I can work around the problem by editing the ContentHandlerAdaptor
class and changing the null prefix into the correct one, but that
would be just completely ridiculous.

I am slowly losing my tiny little mind. What is the deal here?