Re: xml pull junit tests

Iain Shigeoka <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <B9A21BD5.ABF6%[email protected]>
On 9/9/02 8:46 AM, "Aleksander Slominski" <[email protected]> wrote:

> Stefan Haustein wrote:
> 
>> the TestSerializeWithNS seems to assume that endDocument closes
>> all open elements. I think it would be cleaner to throw an
>> IllegalStateException if endDocument is called while still
>> tags are open?
> 
> hi,
> 
> this is just for convenience -  when closing documents it makes sense to
> close all unclosed tags by writing them.
> 
>   /**
>    * Finish writing. All unclosed start tags will be closed and output
>    * will be flushed. After calling this method no more output can be
>    * serialized until next call to setOutput()
>    */
>   public void endDocument ()
>       throws IOException, IllegalArgumentException, IllegalStateException;
> 
> do you think that this shoul dbe an error condition?

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.

If it is a problem, perhaps a property could be set to throw an exception
(sort of like being in validating mode for output I guess).

-iain
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.