mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niklas Gustavsson <nik...@protocol7.com>
Subject Re: [VYSPER] Creating stanza without namespace
Date Wed, 13 Jun 2012 05:52:08 GMT
On Tue, Jun 12, 2012 at 7:01 PM, Eilon Yardeni <eilon.yardeni@8x8.com> wrote:
> I would like to create empty element in a stanza.
> Using the startInnerElement API always adds a namespace attribute.

It's not perfectly clear what you want to accomplish, so please
correct me if I understood you wrong. An XML element when namespace
aware can either be in a namespace or in the empty namespace.
Namespaces are by default inherited from the element parent. So, if
you want your inner element to be in the empty namespace, you need:

<outer xmlns="http://example.com"><inner xmlns="" /></outer>

Inner must here override the namespace from it's parent and thus need
the xmlns="" stuff.

In Vysper:
new XMLElementBuilder("outer",

If you want the inner namespace to have the same namespace as it's parent:

<outer xmlns="http://example.com"><inner /></outer>

In Vysper:
new XMLElementBuilder("outer",

You can also use namespace prefixes as aliases for the full URL, but
I'm not sure if that makes any difference for your question.


View raw message