[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
For all dummys like me, here is the correct way to solve the problem above: call _serializer.setPrefix("", NAMESPACE); where NAMESPACE := the default namespace of your xml then call _serializer.startTag(NAMESPACE, "test"); ... _serializer.endTag(NAMESPACE, "test"); "null" is not needed anymore and yet it results in an "plain" xml. Thanks! On 20 Feb., 13:27, Sky wrote: > Hi, > > to come back to a way of solution. Does anyone know how to solve the > described problem? > Is the only way to write a new XMLWriter without XML Serializer? > > Thanks! > > On 15 Feb., 23:06, Sky wrote: > > > Hi, > > > I do not want to write my XML Serialization new. its complex, and time > > is expensive. And currently it works perfectly on all Android Versions > > < 2.3. I think things should not be downgraded from one to another > > release, except something gets deprecated. Its like Street of Boston > > said its a regression. > > And besides: How to write plain XML with Serializer now with the > > changes from above? It is not possible anymore? Can we only write XML > > with Namespaces now? This should be documented somewhere... > > > On 15 Feb., 22:38, Kostya Vasilyev wrote: > > > > Could you write the XML file yourself, just with "print" type statements? > > > > Not as convenient as using a serializer, and probably not as pretty > > > (indents, attributes and stuff), but if it's meant as input for another > > > program, it probably doesn't have to be perfect, right? > > > > -- Kostya > > > > 13.02.2011 23:22, Sky пишет: > > > > > Yes, this is exactly what I want to do. Write old plain XML without > > > > Namespace. > > > > The question is how I get it to work on Andorid 2.3? > > > > > On 13 Feb., 21:04, Streets Of Boston wrote: > > > >> I think it was mainly meant for XML documents that don't use > > > >> namespaces at > > > >> all, since there is no startTag(String elementName) method. > > > > >> And i think you can leave it null if it implicitly takes on the > > > >> namespace of > > > >> its parent-element. > > > > >> Whether the acceptance of null for this parameter is OK or not, if > > > >> it's not > > > >> working in 2.3.3 but working as documented in 2.2 and earlier, it is a > > > >> regression. > > > > -- > > > Kostya Vasilyev --http://kmansoft.wordpress.com > > -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
Hi, to come back to a way of solution. Does anyone know how to solve the described problem? Is the only way to write a new XMLWriter without XML Serializer? Thanks! On 15 Feb., 23:06, Sky wrote: > Hi, > > I do not want to write my XML Serialization new. its complex, and time > is expensive. And currently it works perfectly on all Android Versions > < 2.3. I think things should not be downgraded from one to another > release, except something gets deprecated. Its like Street of Boston > said its a regression. > And besides: How to write plain XML with Serializer now with the > changes from above? It is not possible anymore? Can we only write XML > with Namespaces now? This should be documented somewhere... > > On 15 Feb., 22:38, Kostya Vasilyev wrote: > > > Could you write the XML file yourself, just with "print" type statements? > > > Not as convenient as using a serializer, and probably not as pretty > > (indents, attributes and stuff), but if it's meant as input for another > > program, it probably doesn't have to be perfect, right? > > > -- Kostya > > > 13.02.2011 23:22, Sky пишет: > > > > Yes, this is exactly what I want to do. Write old plain XML without > > > Namespace. > > > The question is how I get it to work on Andorid 2.3? > > > > On 13 Feb., 21:04, Streets Of Boston wrote: > > >> I think it was mainly meant for XML documents that don't use namespaces > > >> at > > >> all, since there is no startTag(String elementName) method. > > > >> And i think you can leave it null if it implicitly takes on the > > >> namespace of > > >> its parent-element. > > > >> Whether the acceptance of null for this parameter is OK or not, if it's > > >> not > > >> working in 2.3.3 but working as documented in 2.2 and earlier, it is a > > >> regression. > > > -- > > Kostya Vasilyev --http://kmansoft.wordpress.com -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
Hi, I do not want to write my XML Serialization new. its complex, and time is expensive. And currently it works perfectly on all Android Versions < 2.3. I think things should not be downgraded from one to another release, except something gets deprecated. Its like Street of Boston said its a regression. And besides: How to write plain XML with Serializer now with the changes from above? It is not possible anymore? Can we only write XML with Namespaces now? This should be documented somewhere... On 15 Feb., 22:38, Kostya Vasilyev wrote: > Could you write the XML file yourself, just with "print" type statements? > > Not as convenient as using a serializer, and probably not as pretty > (indents, attributes and stuff), but if it's meant as input for another > program, it probably doesn't have to be perfect, right? > > -- Kostya > > 13.02.2011 23:22, Sky пишет: > > > > > Yes, this is exactly what I want to do. Write old plain XML without > > Namespace. > > The question is how I get it to work on Andorid 2.3? > > > On 13 Feb., 21:04, Streets Of Boston wrote: > >> I think it was mainly meant for XML documents that don't use namespaces at > >> all, since there is no startTag(String elementName) method. > > >> And i think you can leave it null if it implicitly takes on the namespace > >> of > >> its parent-element. > > >> Whether the acceptance of null for this parameter is OK or not, if it's not > >> working in 2.3.3 but working as documented in 2.2 and earlier, it is a > >> regression. > > -- > Kostya Vasilyev --http://kmansoft.wordpress.com -- 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
Re: [android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
Could you write the XML file yourself, just with "print" type statements? Not as convenient as using a serializer, and probably not as pretty (indents, attributes and stuff), but if it's meant as input for another program, it probably doesn't have to be perfect, right? -- Kostya 13.02.2011 23:22, Sky пишет: Yes, this is exactly what I want to do. Write old plain XML without Namespace. The question is how I get it to work on Andorid 2.3? On 13 Feb., 21:04, Streets Of Boston wrote: I think it was mainly meant for XML documents that don't use namespaces at all, since there is no startTag(String elementName) method. And i think you can leave it null if it implicitly takes on the namespace of its parent-element. Whether the acceptance of null for this parameter is OK or not, if it's not working in 2.3.3 but working as documented in 2.2 and earlier, it is a regression. -- Kostya Vasilyev -- http://kmansoft.wordpress.com -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
Yes, this is exactly what I want to do. Write old plain XML without Namespace. The question is how I get it to work on Andorid 2.3? On 13 Feb., 21:04, Streets Of Boston wrote: > I think it was mainly meant for XML documents that don't use namespaces at > all, since there is no startTag(String elementName) method. > > And i think you can leave it null if it implicitly takes on the namespace of > its parent-element. > > Whether the acceptance of null for this parameter is OK or not, if it's not > working in 2.3.3 but working as documented in 2.2 and earlier, it is a > regression. -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
I testet the java.xml.XMLConstants.NULL_NS_URi: private static final String NAMESPACE = XMLConstants.NULL_NS_URI; _serializer.setPrefix("", NAMESPACE); _serializer.startTag(NAMESPACE, "gpx"); Now there is the following error. How would you handle tha? (For clarification I want to write a xml with no namespace. For example example) IllegalStateException: Cannot set default namespace for elements in no namespace at org.kxml2.io.KXmlSerializer.startTag(KxmlSerializer.Java 405) I think something is not correct in the Android 2.3 Version... I wonder why I am the only one who has this problem... On 13 Feb., 06:09, Streets Of Boston wrote: > The documentation of the *startTag* method mentions this: > "... If namespace is null no namespace prefix is printed but just name..." > > Regardless of the XML starndard, this means that null is a valid and > documented input for this method. If this has suddenly become broken in 2.3 > (i haven't seen this problem, though), then that's a regression of the > method and a bug. -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
Thanks for the clarification Bob! I will try to change my code. Nevertheless like Streets of Boston said, I would say that this is a bug and should be changed, at least in the docs. On 13 Feb., 06:09, Streets Of Boston wrote: > The documentation of the *startTag* method mentions this: > "... If namespace is null no namespace prefix is printed but just name..." > > Regardless of the XML starndard, this means that null is a valid and > documented input for this method. If this has suddenly become broken in 2.3 > (i haven't seen this problem, though), then that's a regression of the > method and a bug. -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
I think it was mainly meant for XML documents that don't use namespaces at all, since there is no startTag(String elementName) method. And i think you can leave it null if it implicitly takes on the namespace of its parent-element. Whether the acceptance of null for this parameter is OK or not, if it's not working in 2.3.3 but working as documented in 2.2 and earlier, it is a regression. -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
I believe the documentation is confused -- and possibly the spec on which it is based. Having a namespace value (null) which causes the the XML to take on some value which cannot be determined except by examining the past program execution trace possibly back all the way to when the document was begin, is crazy. Note very carefully: "no namespace prefix is printed but just the name" is suddenly departing from the realm of semantics, where every other value for the namespace parameter resides, to PURELY COSMETIC SYNTAX -- and leaving the choice of ACTUAL NAMESPACE to the luck of the draw. Every other value there is precisely the reverse: specify the namespace, and leave the cosmetic choice of prefix up to the context in which it is used (including a preceding call to setPrefix()). Any code which supplies null here, and is called by other code, will behave with different semantics, depending on NON-SEMANTIC CHANGES in the calling code. Remember, namespace prefixes DO NOT CONVEY SEMANTIC CONTENT. They are cosmetic. You can replace all the namespace prefixes in an XML document with x001: x002:, etc., and not change the meaning of the document at all. It is entirely understandable that people are confused by this. It is also entirely necessary that people get clear on it. I will argue that it is HARMFUL to accept null here. I don't know how to weigh that harm against the known harm of breaking code that runs, but it is definitely not "free" to accept null -- and given that it has already broken the code, I argue it should NOT start accepting null again, but rather should be properly documented as offering no direct control over the choice of namespace prefixes in this method (and refer to setPrefix()), and document it as throwing a NullPointerException if either argument is null. -- 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
[android-developers] Re: Serious problem on Android 2.3 and XmlSerializer
The documentation of the *startTag* method mentions this: "... If namespace is null no namespace prefix is printed but just name..." Regardless of the XML starndard, this means that null is a valid and documented input for this method. If this has suddenly become broken in 2.3 (i haven't seen this problem, though), then that's a regression of the method and a bug. -- 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
[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: 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en