[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Writer version 0.2

  • From: David Megginson <david@m...>
  • To: xml-dev@x...
  • Date: Mon, 18 Sep 2000 11:55:38 -0400

xml writer dataelement
There is a new version of my SAX2/Java-based XML Writer available at

  http://www.megginson.com/Software/

Version 0.1 was accidentally shipped without source code just before I
had a hardware failure in my hard drive, so the source code was lost.
I have decompiled the Java class files from that release and
recommented and enhanced them with many new convenience methods.

There is also a new class for writing data- or field-oriented XML,
with automatic newlines and indentation.  It works like this:

	DataWriter w = new DataWriter();
	w.setIndentStep(2);

	w.startDocument();
	w.startElement("foo");
	w.dataElement("bar", "1");
	w.dataElement("bar", "2");
	w.startElement("hack");
	w.dataElement("fubar", "zing");
	w.endElement("hack");
	w.dataElement("bar", "3");
	w.endElement("foo");
	w.endDocument();

This will give you the following document:

  <?xml version="1.0" standalone="yes"?>

  <foo>
    <bar>1</bar>
    <bar>2</bar>
    <hack>
      <fubar>zing</fubar>
    </hack>
    <bar>3</bar>
  </foo>

(Of course, there are also methods available to pass NamespaceURIs,
attribute lists, and QNames).

Both classes work as regular SAX2 filters, so you can stick them
anywhere in your filter chain (the data writer also passes and extra
indentation or newlines down the chain in characters() events).

These classes are in the Public Domain, and come with no warranty,
etc. etc.


All the best,


David

-- 
David Megginson                 david@m...
           http://www.megginson.com/

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.