XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] XMLOut - generating xml from programs


>
>    wax.start("car").text("Prius").end().close();
>
> You'd have:
>
>    altWax.start("car").text("Prius").end("car");
>

Both of these look fine when you're writing literal text. But how does 
it work when you're working your way down a Java hierarchy translating 
it into an XML heirarchy?

Here I think I feel more comfortable with the way I do it today, with an 
XMLStreamWriter:

public void toXML(XMLStreamWriter out) {
   out.startElement("car");
   for (Part part: getParts()) {
       part.toXML(out);
   }
   out.endElement();
}

I agree that the redundant name in the endElement call can be very 
useful when debugging. Make it optional.

Michael Kay
Saxonica



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS