Hi all,

When we are using the XMLStreamWriter.writeNamespace, do we need to call
the XMLStreamWriter.setPrefix method as well ?

If I explain more :

Lets take the following XML as the example.

 <x:Foo xmlns:x="whatever.org" xmlns:y="whatever.org">
        <y:Bar />
 </x:Foo>

How I write this using the writer api is that, I first write all the
namespace declarations of the Foo element. After that parser has writen
y namespace as well. Then if I try to get the namespace for the prefix
y, to write Bar element, the woodstox parser returns null.
But if I call the setPrefix method when writing the namespace in the Foo
element, then this problem won't occur.

I checked StAX api to see the intended behaviour of the writeNamespace
method to see whether we have to call setPrefix or not, but its silent
about this.

IIRC, this is happening as expected in the StAX RI implemented by BEA.

What is the correct or accepted behavior ?

-- Chinthaka

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to