Tiny API for Markup, Parser
Date: Tue, 20 Aug 2002 11:01:09 -0400 From: Simon St.Laurent <firstname.lastname@example.org> To: email@example.com Subject: Tiny API for Markup, Parser
I've released a first version of the Tiny API for Markup (TAM) and a Java 2 Micro Edition parser that supports it. I originally started writing this as part of a project for supporting a very small subset of SVG on the Palm, but it acquired a life of its own. See:
The API is based loosely on SAX2, though the looseness has increased over time. TAM both subsets and supersets SAX2's core ContentHandler interface, and changes from (uri, localName, qName) to (uri, localName, prefix). SAX2 developers should find it familiar, but direct compatibility with SAX2 was definitely not a goal.
This parser is not XML 1.0-compliant, primarily because it doesn't support DOCTYPE processing at all. J2ME is a very constrictive environment, so I've made some reductions and passed responsibility from the parser to the application. The TAM API provides an event that reports the entire DOCTYPE declaration to the application, which is then responsible for any DOCTYPE processing that may be necessary. TAM will resolve simple entities if the application registers them with the parser, but does not handle entities which contain markup - that's a job for the application.
This parser does support namespaces, and namespace declarations are reported as attributes. The startPrefix/endPrefix methods of SAX2 are not supported by TAM.
The current version also does very little character checking of markup, and while it normalizes line-ends, it doesn't do attribute white-space normalization. These features (and DOCTYPE processing) will appear in a later version of the parser which supports more of XML 1.0 and also Markup Object Events (MOE):
The TAM API interface and TAMException class are in the public domain, while the parser is licensed under the Mozilla Public License, version 1.1. While this code is written for J2ME, it also works in J2SE and should be fine in any Java 2 environment.
Simon St.Laurent - SSL is my TLA http://simonstl.com may be my URI http://monasticxml.org may be my ascetic URI urn:oid:18.104.22.168.4.1.6320 is another possibility altogether
Prepared by Robin Cover for The XML Cover Pages archive.