users@jaxb.java.net

Re: Extent the root tag with xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ???

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 04 Jun 2003 09:02:57 -0700

Christoph Brunner <news_chbr0001_at_YAHOO.DE> wrote:
> If i generate XML with JAXB i want to customize my root tag like the following:
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> ..
> ..
> ..
> </root>
>
> If i export currently the XML data the output is without that!
>
> Is there a possibility to customize the root tag in java?

You can't make JAXB to do this, but you can combine JAXB with your
component that does this.

Search the archive with keywords like "XMLWriter". There's a lot of
previous posts about specifying your own XML writers, and this is one of
the things you can do with your custom writer.


But I'm curious why you want to declare a namespace by yourself. I mean,
if your document is using that namespace, JAXB will declare it for you,
won't it.

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