Saturday, February 12, 2011

[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer

While you are not crazy to think null might mean something useful, let me point out the line of reasoning you need to follow:

Exactly what namespace did you expect null to give you? Why do you hold the opinion that null should give you this namespace?

And exactly what namespace are you calling the "null-Namespace"?

If you want the same namespace that results when you don't specify a namespace, for example the namespace in the only element in this trivial document: <trivialDocument/>
Then what you want is java.xml.XMLConstants.NULL_NS_URI. You supply this to the startTag() method.

If you want the namespace is that currently associated with no prefix (what the standard calls the "default namespace"), you use a prefix of "" and the namespace of whatever namespace you want that prefix to be used, in a call to setPrefix(), then call startTag() using the exact same namespace.

Where does null fit in here? The XML standards are not written assuming that programming languages even have a concept of null. I know of no context in any language or API in which null is a valid URI.

I hope that makes it both clear, and seem less strange.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate