dev@fi.java.net

Re: JAXB and Namespaces

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 14 Jun 2005 09:57:54 -0700

Paul Sandoz wrote:
> Hi Kohsuke,
>
> A couple of questions on namespaces.
>
> When serializing "bound XML" will the XML namespace ever be declared
> such that it will be written?

You mean it will be "overwritten"? I suspect that it doesn't.

> Is there a way to obtain the namespace URI index (the one set on the
> Name produced by the NameBuilder) from the NamespaceContextImpl.Element
> class?

Right now you can't do that quickly, but we can certainly add it.

But the only time you want to get prefix -> nsUri is when the
XMLSerializer uses (int prefix, String localName), which is for dynamic
unbound contents, which could be slower.

Whereas maintaining prefix -> nsUri cost would be incur cost even if
such a method is never used. So is that going to be a justifiable trade-off?

> When using the nsUriIndex2prefixIndex array is the same prefix index
> returned for the same uri index over the period of serialization?

Yes, I think so. Unless the serialization goes into the wildcard or some
such.



-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com