Re: [Fwd: Re: Xml-commons]
Aleksander Slominski <[email protected]>
| Newsgroups | gmane.text.xml.xmlpull.devel |
|---|---|
| Message-ID | <[email protected]> |
hi Stefan,
i think that is matter of style ans some people will argue that
this is more aesthetically pleasing (and corresponds better to nested XML)
XmlSerializer xs = new XmlSerializer();
xs.setInput (writer);
xs.startTag("", "person");
.attribute("", "name", person.getName());
.attribute("", "age", person.getAge());
.endTag ("", "person");
xs.flush();
than:
XmlSerializer xs = new XmlSerializer();
xs.setInput (writer);
xs.startTag("", "person");
xs.attribute("", "name", person.getName());
xs.attribute("", "age", person.getAge());
xs.endTag ("", "person");
xs.flush();
it is similar to argument about StringBuffer append() chaining.
i think we should provide to XmlSerializer users a choice to
use style of code writing they fell comfortable with?
(in my opinion both styles are fine).
thanks,
alek
Stefan Haustein wrote:
> Aleksander Slominski wrote:
> >
> > i have seen this interesting post about XmlWriter (see below).
> >
> (...)
> >
> > the only think we do no have is ECS style chaining ,example:
>
> Hi Alek,
>
> In my opinion, chaining is bad style.
>
> The following code snippet is not any bit less readable:
>
> public void writePerson(Person person, Writer writer) {
>
> XmlSerializer xs = new XmlSerializer();
> xs.setInput (writer);
> xs.startTag("", "person");
> xs.attribute("", "name", person.getName());
> xs.attribute("", "age", person.getAge());
> xs.endTag ("", "person");
> xs.flush();
> }
>
> Aleksander Slominski wrote:
> > hi,
> >
> > i have seen this interesting post about XmlWriter (see below).
> >
> > i think that XmlPull API could work as such utility as well,
> > XmlWriter has following features:
> >
> > * Wrap a java.io.Writer
> > * Provide a Writer-like API
> > * Take care of as much of the XML handling as possible
> > * Avoid a large object structure
> > * Allow the ECS chaining style
> >
> > the only think we do no have is ECS style chaining ,example:
> >
> > http://builder.com.com/utils/sidebar.jhtml?id=u00220020318yan01.htm&index=7
> >
> > it is easy to fix and will make XmlSerializer to be superset of XmlWriter
> > (as XmlWriter has no support for namespaces), so i propose to add
> > return XmlSerializer for all void "write" operations like
> >
> > XmlSerializer startTag(...)
> >
> > what do you think about it?
> >
> > thanks,
> >
> > alek
> >
> > ps. see actual class at
> > http://www.generationjava.com/projects/XmlWriter.shtml
> >
> >
> > -------- Original Message --------
> > Subject: Re: Xml-commons
> > Date: Fri, 9 Aug 2002 13:41:35 -0400 (EDT)
> > From: Henri Yandell <[email protected]>
> > Reply-To: [email protected]
> > To: <[email protected]>
> >
> > Apologies.
> >
> > http://builder.com.com/article.jhtml?id=u00220020318yan01.htm&page=1&vf=tt
> >
> > Konquerer and builder.com appear to have issues.
> >
> > Hen
> >
> > On Fri, 9 Aug 2002, Henri Yandell wrote:
> >
> >
> >>I've some String based Xml utils that are currently split between my
> >>personal codebase or in Jakarta Commons Util. The general nature of it all
> >>is to make Xml handling easier for small things.
> >>
> >>So some simple Xml semi-parsing functions that let you pull data easily
> >>from Xml snippets without having to bash together a full on parser, and an
> >>XmlWriter for outputting Xml nicely [see
> >>http://www.techrepublic.com/images/ads/c005_builder.html or
> >>http://techupdate.zdnet.fr/story/0,,t381-s2109583,00.html for french].
> >>
> >>None of it is very high-brow, but I feel it solves small-time issues
> >>nicely.
> >>
> >>My questions are:
> >>
> >>1) Is it an xml.apache.org thing or a jakarta.apache.org thing?
> >>2) Xml-Commons or Jakarta.Commons.Util.xml
> >>3) Where do I discuss Xml-Commons.
> >>
> >>Thanks,
> >>
> >>Hen
> >>
> >>
> >>---------------------------------------------------------------------
> >>In case of troubles, e-mail: [email protected]
> >>To unsubscribe, e-mail: [email protected]
> >>For additional commands, e-mail: [email protected]
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > In case of troubles, e-mail: [email protected]
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> > To unsubscribe from this group, send an email to:
> > [email protected]
> >
> >
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
> To unsubscribe from this group, send an email to:
> [email protected]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/