users@jaxb.java.net

Re: unexpected attribute xmlns:ns1

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 28 Jan 2003 09:45:57 -0800

Thanks. Looking from your code, it looks like there's indeed a problem
in Oracle's XML parser. It doesn't seem to behave as it should be.

I think the workaround is for you to create a SAXParser by yourself and
pass it to the unmarshaller, like this:

    SAXParser p = myCreateSAXParserFunction();
    unmarshaler.unmarshal(
       new SAXSource( p.getXMLReader(), byteArrayInputStream) );


SAXSource allows you to specify an XMLReader, and when you do so, the
unmarshaller will use it.


> As for the platform dependence of marshaller/unmarshaller, my guess is the
> parser was loaded by Thread.currentThread().getContextClassLoader().
> Outside the container, the runtime classloader loads an apache sax parser,
> but inside the orion container, classloader loads an oracle sax parser.
> I expericed similar problem when initializing JAXBContext the standard way
> with JaxBContext.newInstance("MicromagSchema").

By default, the JAXB RI unmarshaller creates a SAX parser by using
standard JAXP idiom (SAXParserFactory.newInstance.)

When you invoke JAXBContext.newInstance, you can pass in a classloader,
just FYI.

regards,
--
Kohsuke KAWAGUCHI                  408-276-7063 (x17063)
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com