Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] User Questions

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Peter Murray-Rust <pm286 AT cam.ac.uk>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] User Questions
  • Date: Mon, 01 Aug 2005 23:57:43 +0100

I hope it is appropriate to ask some questions from the point of view of
a new user.

I have recently taken the decision to convert the java support of CML
(Chemical Markup Language) to XOM, having probably wasted years of my
life trying to use the W3C DOM. I agree with Eliotte's critique of the
DOM - which is has been particularly useful since until reading I
thought it was my incompetence. I now have a prrof of concept which
seems very viable - I like everything about XOM. As CML has some very
challenging requirements I would be grateful of some detailed and
strategic advice, and so explain my strategy briefly. (It is possible
that other XML designers might have similar ideas and I'd be grateful
for pointers).

After several refactorings, CML has evolved to a system based
syntactically on W3C Schema (because - possibly mistakenly - I thought
this would be the most generally accepted and implemented technology.
In practice the content models are of virtually no use in chemistry but
the attributes, including W3C dataTypes (and others built from them),
express what I need. CML groups can therefore build their own schemas
from the elements and add those attributes which they need. Limited
chemical validations is done through W3C datatypes (I have written a
simple validator rather than use tools such as Xerces because I have to
port this to C++, Python and FORTRAN). I have found that schematron
expresses many of the syntactic (but not semantic) constraints of
chemistry and I am starting to add schematron validation within the
<appinfo/> elements for each CML element (there are about 70 non-trivial
CML elements).

CML is therefore built as a set of subclasses of XOM - ca 100 - in which
the Attributes are also subclassed. These subclasses are built
automatically from the schema so that bespoke code is generated for any
users schema. For example a CMLNodeFactory is subclassed from
NodeFactory.

My questions include:

* is it a good idea to subclass Document to CMLDocument? (I had to do
this for W3C as it was the only way to to create subclasses).
* What is the role of a Document (it is much less central than in W3C).
Obviously it holds the prolog, etc. I note that it cannot be detached
from its rootElement. (I sometimes need to replace a rootElement with
its child, and this seems to be forbidden without copying the tree.
* Is is possible to serialize a Node other than document without making
a copy?
* Is there a simple way to run schematron from within XOM? I can build
up the XSLT transform, but wonder if there is something prettier.
* is there every likely to be support for W3C dataTypes in XOM. At
present I create my own subclasses (e.g. Integer, IntegerList, etc).

With best wishes and thanks for a major contribution.

P.

--
Peter Murray-Rust
Unilever Centre for Molecular Informatics,





Archive powered by MHonArc 2.6.24.

Top of Page