users@jaxb.java.net

Re: JAXB conversion of wildcard to DOM (<xjc:dom />) stripping ou t namespace attributes

From: Geis, Matt <Matt.Geis_at_schwab.com>
Date: Wed, 23 Jul 2003 15:30:48 -0700

By *re*-moving, I was making a joking reference to the **removal** of
namespace attributes. Basically, see my previous email for the example. I
have an element defined as xsd:any. The sub-elements contain namespace
attributes. Anything in the sub-elements that is xmlns gets stripped out.

I tried what you suggested, passing a SAXSource to the unmarshaller, and got
the following error (even after setting the namespace-prefixes property to
true.

DefaultValidationEventHandler: [ERROR]: unexpected attribute "xmlns"

So in short, that test failed.

Thanks,
Matt

-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Wednesday, July 23, 2003 3:11 PM
To: Geis, Matt; jaxb-interest_at_java.sun.com
Subject: Re: JAXB conversion of wildcard to DOM (<xjc:dom />) stripping ou t
na mespace attributes


> The *re*-moving of attributes, on the other hand, is really what inspired
my
> email in the first place.

OK, I think I'm not aware of any case where JAXB causes this problem.
Can you elaborate on it?


> Thanks for the quick reply. Please keep me informed on whether you're
able
> to come up with a workaround.

Unfortunately, it seems like a fix requires some RI code change.

One possibility is to:

1. create an XMLReader by yourself
2. configure it with "http://xml.org/sax/features//namespace-prefixes"
   SAX property to true,
3. use SAXSource to pass it to the unmarshaller

If you could test this quickly and tell us if it works, that's great.

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