Removal of empty namespaces

2 views
Skip to first unread message

DaveInNYC

unread,
Nov 28, 2009, 5:21:13 PM11/28/09
to jabber-net
I have been having the damnedest time putting .NET objects that I
serialize into XML into one of my custom classes derived from Element.
These objects do not have an XML namespace, so they are inheriting my
default XML namespace, which of course breaks things on
deserialization. After much debugging, I finally realize that Elemnt
overrides OuterXml, and it takes out empty namespace declarations!
This is why the serialized objects were not keeping their "empty
namespace" status.

Anyway, does anyone know if it would do any harm for me to remove the
code that strips the empty namespaces? I could always do some other
work around, but would rather not.

DaveInNYC

unread,
Dec 3, 2009, 10:49:46 AM12/3/09
to jabber-net
FWIW, took care of this by setting the DefaultNamespace when
serializing/deserializing. Some days I feel like I need to go back
to .NET 101 :(

Joe Hildebrand

unread,
Dec 3, 2009, 12:03:34 PM12/3/09
to jabbe...@googlegroups.com
Why are you using elements with "no" namespace? (aside, all elements have a namespace, even if it's the empty one)

It's idiomatic XMPP to always add your extensions in a new namespace.
> --
>
> You received this message because you are subscribed to the Google Groups "jabber-net" group.
> To post to this group, send email to jabbe...@googlegroups.com.
> To unsubscribe from this group, send email to jabber-net+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jabber-net?hl=en.
>
>

Message has been deleted

DaveInNYC

unread,
Dec 4, 2009, 2:12:29 PM12/4/09
to jabber-net


On Dec 3, 12:03 pm, Joe Hildebrand <hil...@gmail.com> wrote:
> Why are you using elements with "no" namespace? (aside, all elements have a namespace, even if it's the empty one)
>
> It's idiomatic XMPP to always add your extensions in a new namespace.
>

By default when you serialize .NET objects like strings, etc. it does
it with the empty namespace. I was able to override that default
behavior by using the DefaultNamespace property.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages