users@jaxb.java.net

Re: xmlns attribute added to the root element after marshalling

From: Marcos <marcos_at_softingsystems.com.br>
Date: Fri, 19 Jan 2007 14:42:35 -0300

Edwin Dankert escreveu:

> If you still want to do this, you can probably extend the
> javax.xml.streamXMLStreamWriter, overwrite the writeNamespace and
> writeDefaultNamespace methods and marshall your objects using your
> special writer marshal(element, writer).

Thanks Edwin !!! it did the trick ;-)

For Marshalling ...
------------------------------------
I've wrapped the XMLStreamWriter class and overrode both methods such as
below.:

    public void writeDefaultNamespace(String string) throws
XMLStreamException {
        // noop
    }

    public void writeNamespace(String string, String string0) throws
XMLStreamException {
        // noop
    }

For Unmarshalling ...
------------------------------------
I've wrapped the XMLStreamReader class and overrode what follows.:

    public String getNamespaceURI() {
        return "http://www.objectweb.org";
    }

Regards
Marcos