OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   XML Writer version 0.2

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <david@megginson.com>
  • To: xml-dev@xml.org
  • Date: Mon, 18 Sep 2000 11:55:38 -0400

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@megginson.com
           http://www.megginson.com/




 

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

Copyright 2001 XML.org. This site is hosted by OASIS