XML News from Friday, March 5, 2004

Sun has released the J2ME Web Services Specification. This describes a subset of JAXP and JAX-RPC intended for talking to SOAP services from Java 2 Micro Edition devices. "The goal of this optional package is to define a strict subset wherever possible of the XML parsing functionality defined in JSR-063 JAXP 1.2 [2] that can be used on the Java 2 Micro Edition Platform (J2ME)".

There are major problems in the SAX subset. Sun is using the confusing, underspecified SAXParser and SAXParserFactory classes instead of the much cleaner, better specified XMLReader and XMLReaderFactory classes. They've also removed ContentHandler completely and replaced it with DefaultHandler. This requires altering signatures in JAXP and makes it substantially more difficult to port standard SAX programs to J2ME.

If Sun really finds true SAX to be inappropriate for a micro environment, then they're free to develop their own API that better fits the needs of small devices. And indeed they're doing exactly that with the StAX API. Thus it's completely unclear to me why they felt the need to fork SAX in this fashion. They keep claiming SAX is too big, but if size were really the concern, I'd expect them to limit themselves to one API for this use case rather than two.