serializer: endDocument() [Re: xml pull junit tests]
Aleksander Slominski <[email protected]>
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
Stefan Haustein wrote: > > I like that it closes out the document (being intelligent enough to close > > tags along the way). It's very convenient to be deep in the tree and simply > > close things out and know that it is well formed. So I vote to keep the > > behavior. > > In my opinion, this leads to sloppy programming, > and it is inconsistent with closeTag, which does > not write implicit close tags. what do you mean by closeTag, do you refer to XmlSerializer? i do not think we have closeTag() but instead implicitly close startTag() when next call is different than attribute() > A cleaner option would be to add a method that > closes a given number of tags. This could also > help for writing exception traces > to a stream for debugging purposes: > > Where handling an exception, this new method could > be used to close all pending elements except from > <html> and <body> (for xhtml documents), allowing > to write a stack trace to the stream properly. however that could be very tricky as we do not expose depth in XmlSerializer interface (getDepth()?). i think that adding new methods should be avoided so i am leaning toward changing endDocument() to require that all start tags are closed. thanks, alek