Hi all,

I am using the XmlSerializer to write XML to the sd-card. My code
works on all versions <= Android 2.2.
With the new Android 2.3 SDK and 2.3 Emulator I get an
NullpointerException:
Stacktrace:
java.lang.NullPointerException
at org.kxml2.io.KXmlSerializer.check(KXmlSerializer.java:75)
at org.kxml2.io.KXmlSerializer.text(KXmlSerializer.java:542)
...

Here is my code:
public class GPXWriter {
private XmlSerializer serializer;
private static final String NAMESPACE =null;
...
serializer.startTag(NAMESPACE , "test");
...
_serializer.endTag(NAMESPACE, "test");
...
}

I think the reason for the problem is the null-Namespace.
In the Javadoc of XmlSerializer(startTag) is written:" If namespace is
empty string then serializer will make sure that default empty
namespace is declared (in XML 1.0 xmlns='')"
-> null is in my opinion a correct value. If I use for example
NAMESPACE = "TEST" it works, but produces wrong xml.
There is a function "public abstract void setPrefix (String prefix,
String namespace)".
But calling this with "" as prefix like described in javadoc does not
fix the problem.
Here is the link to the javadoc
http://developer.android.com/reference/org/xmlpull/v1/XmlSerializer.html#startTag%28java.lang.String,%20java.lang.String%29

Does anyone know how to fix the problem?

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to