Re: asymmetry between serialzier and parser in writing XMLDecl

Elliotte Rusty Harold <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <p04330100b9913d12e177@[192.168.254.4]>
>in XmlSerializer writing XMLDecl (<?xml version='1.0' ...?>) is supported
>by startDocument() method however XmlPullParser will report XMLDecl as PI.
>and each rountrip will add second <?xml as it thinks it is just another PI
>(unless there is special code to detect that PI is really XMLDecl ...)
>
>if we use isWhitespace() (or isEmptyElementTag()) to signalize that PI
>is not a real PI and should be ignored but instead interpreted as 
>XML declaration ...
>

I don't see how this would fix it. The XML declaration is not a 
processing instruction. XmlPullParser should not report it as one. 
Overloading isWhiteSpace() or isEmptyElementTag() with a completely 
different meaning that has nothing to do with white space or 
empty-element tags just confuses the issue  further, and is totally 
non-obvious.

Either XmlPullParser should not report the XML declaration at all, or 
it should have a different token type to represent this construct.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | [email protected] | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.