Re: chaining serializer calls

Aleksander Slominski <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
Stefan Haustein wrote:

> > when i was using XmlSerializer i have realized it would be very handy to
> > be able to chain serialization calls by returning this XmlSerializer instance
> > from all void serialization calls, ex:
> >
> >  ser.startTag("", "foo");
> >  ser.text("test");
> >  ser.endTag("", "foo");
> >
> > would could be written as:
> >
> >  ser.startTag("", "foo").text("test").endTag("", "foo");
> >
> > what do you think about it?
>
> In my opinion, it does not buy too much, and the chain would be
> broken where methods have "real" return values. So I think it
> would create more confusion than really help.

the only methods that return value:
    public String getPrefix (String namespace, boolean generatePrefix);
    public Object getProperty(String name);
    public boolean getFeature(String name);
are not used to write output.

this is just sugar syntax - it has no other justification then
to make easier to write XML serialization code
but still if we can make it easier why not do it?

thanks,

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