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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Announcement: XMLWriter and XMLNorm

[ Lists Home | Date Index | Thread Index ]
  • From: David Megginson <david@megginson.com>
  • To: "XML Developers' List" <xml-dev@ic.ac.uk>
  • Date: Wed, 21 Jul 1999 21:48:27 -0400 (EDT)

Since I need them for several projects, I've created a couple of
smallish Java classes.  One is a DocumentHandler and DTDHandler that
writes an XML document back out to a Java Writer (like James Clark's
XMLTest, only much more configurable), and one is an application for
normalizing XML documents.  The classes are

  com.megginson.sax.XMLWriter
  com.megginson.sax.XMLNorm

Since it's short, here's the README itself:

************************************************************************
com.megginson.sax.XMLWriter - a class for writing XML documents
************************************************************************

This distribution contains a simple class,
com.megginson.sax.XMLWriter, which writes an XML document based
(mostly) on SAX events.  The writer implements the SAX 1.0
DocumentHandler and DTDHandler interfaces, and is highly configurable;
using flags, the application can specify any of the following actions:

- escape non-ASCII characters as character references
- add newlines in tags to improve readability
- include a simple DOCTYPE declaration, with any notation and
  unparsed entity declarations
- omit the XML declaration
- display attributes in random, unsorted order (for efficiency)
- attempt level-3 HTML browser compatibility, by killing the XML
  declaration, DOCTYPE declaration, and processing instructions, and
  adding a space before the closing delimiter of empty element tags

The output goes to a Writer provided by the application, and can use
any character encoding supported by the Java installation.


************************************************************************
com.megginson.sax.XMLNorm - an application for normalizing XML
                            documents.
************************************************************************

This distribution also contains an application,
com.megginson.sax.XMLNorm, that produces a normalized version of an
XML document, like James Clark's XMLTest class.  The usage is

  java com.megginson.sax.XMLNorm [opts] <file-or-uri>

The following options are available:

  -a: escape non-ASCII characters
  -d: include DOCTYPE declaration
  -h: display this help
  -n: add newlines in tags for readability
  -x: don't include the XML declaration
  -u: unsorted attributes (random order)
  -3: level-3 HTML browser compatibility kludges
  -o <file>: print output to the specified file
  -e <encoding>: use the specified output encoding

If you have a network connection, you can try the following:

  java com.megginson.sax.XMLNorm http://home.sprynet.com/~dmeggins/texts/darkness/darkness.xml

(You can also try for other, shorter XML documents.)

By default, this application attempts to use Microstar's free AElfred
parser (http://www.microstar.com/), but you can use the
org.xml.sax.parser to point it to any other SAX-conformant parser.


------------------------------------------------------------------------
David Megginson, david@megginson.com
21 July 1999


All the best,


David

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

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)






 

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

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