cashew-s-editor
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[CASHeW-s-Editor] Java-based XML support


From: Andrew John Hughes
Subject: [CASHeW-s-Editor] Java-based XML support
Date: Wed, 02 Mar 2005 19:34:35 +0000

Hi all,
        Following our discussion today, I did a quick survey of the support for
XML in the Java API.  There are the obvious ones ,javax.xml.parsers,
org.xml.sax.* and org.w3c.dom.*, which support XML parsing, and
javax.xml.transform.*, which supports XSLT.  With this, you only have
basic support for parsing, transforming and outputting XML with DTDs.
        1.5 updates the main Java specification to JAXP 1.3, which gives:

* javax.xml.namespace -- the XML Namespaces standard
(http://www.w3.org/TR/REC-xml-names/#ns-qualnames)
* javax.xml.xpath -- http://www.w3.org/TR/xpath (presumably this was
internal to XSLT before)
* javax.xml.validation -- validation prior to 1.5 is via parser-based
support for DTDs.  This is now separated out into this class hierarchy,
along with XML Schema validation (http://www.w3.org/XML/Schema) and
RELAX-NG validation (http://www.relaxng.org/)
* javax.xml.datatype -- which looks like a Java<-->XML data mapping,
but, at the moment, is just a wrapper for the date classes, in order to
provide validation of XML Schema's date/time types.

As usual, these are primarily interfaces.  For anyone who doesn't know,
the Java specification is *not* documentation of Sun's implementation.
It is a general document with one design goal being to allow other
independent implementations (such as GNU Classpath
(http://www.gnu.org/software/classpath) which I work on).  Thus, these
are specifications of the API which should be used by the code of those
who use existing implementations (such as Sun's JDK).  They are not the
whole story (which may have been one reason why XMLEncoder/Decoder were
slightly more confusing).  Nearly everything in the API also relies on
implementation-specific classes (com.sun.* in Sun's implementation,
gnu.* in GNU Classpath), which you should NEVER use directly if you want
to be at all portable.

The reason I'm explaining this here is because things such as validation
and the quality of the XML parsers rely on which implementation is
actually working behind the scenes (in the case of Sun's, it's a variant
of Apache's).  Particularly with the validation, it is designed so that
a particular implementation can implement less classes or usually more.
As far as I can tell, XML Schema and RelaxNG support are required by
constants in the public specification, so these are fairly safe to
assume.  Most things are implemented like this in the Java
specification, from fairly advanced stuff like the image
(javax.imageio.*) and sound (javax.sound.*) support to the basic stuff
like localisation/internationalisation.  In these terms, Sun's
implementation is a reference implementation, and usually doesn't
provide the most support possible; it's just meant to set the concepts
for other users.

Anyway, I'll let you go and have a look at these.  Don't feel you have
to use anything, but I know Barry was particularly interested in having
a schema for the serialised XML data (which unfortunately, even 1.5 can
only validate!).  There is something called JAXB in the web services
pack that may be useful, but this is currently only available in a
proprietary form from Sun.  This seems to provide Java<-->XML mappings,
but from the specification, it's hard to tell to what degree (again, the
actual handlers will be internal).

I do wonder if IBM's WSDL4Java (included in Axis) may be of use (as WSDL
requires schema parsing), but Google's only findings are the 'HappyAxis'
pages from various Axis installations!

Cheers,
-- 
Andrew :-)

Please avoid sending me Microsoft Office (e.g. Word, PowerPoint)
attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html

No software patents in Europe -- http://nosoftwarepatents.com

"Value your freedom, or you will lose it, teaches history. 
`Don't bother us with politics' respond those who don't want to learn." 
-- Richard Stallman

"We've all been part of the biggest beta test the world has ever known
--
Windows" 
-- Victor Wheatman, Gartner


Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]