----- Original Message ----- From: "Thibaut Barrère" <[EMAIL PROTECTED]> > Hi, > > I have to generate a very simple XML from scratch for B2B, programmatically. > I thought about using the XmlWriter and making looped calls to > startElement/endElement - for those who are familiar with .NET, in the same > way as an XmlTextWriter. > > Is the XmlWriter the preferred way of doing this ? I don't want to create a > full document in memory, just to generate on-the-fly document to a stream > with a low memory footprint.
The XMLWriter also implements the SAX ContentHandler interface, so you can fire SAX events directly into the XMLWriter. So the XMLWriter class can take XML fragments (Element subtrees), whole XML documents, nodes or SAX events. FWIW there's a JSR being defined to create a pull parsing API, called StAX, which is going to be vagulely similar to .NET's XmlReader/XmlWriter classes. Once its done we'll integrate support for it into dom4j. http://jcp.org/jsr/detail/173.jsp James ------- http://james.weblogger.com/ __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by: OSDN - Tired of that same old cell phone? Get a new here for FREE! https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390 _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user