Standard XML APIs (was Re: CDATA by any other name...)

david at megginson.com david at megginson.com
Tue Nov 3 14:31:00 GMT 1998


Paul Prescod writes:

 > I find it odd that we can have "standard APIs" for the full
 > complexity of relational data, and probably eventually for object
 > database data, but it is perceived to be impossible to do the same
 > for the parse tree of XML data. I mean it is just annotated tree
 > structures: it shouldn't be rocket science (but neither is it
 > trivial).

Let's divide the use of XML into two fairly arbitrary groups
(acknowledging that there's considerable overlap):

1. Documents
2. Data

Group #1 (documents) is characterised by long sequences of mixed
content inside block-level containers (often paragraphs, but possibly
subtasks or steps in technical documentation); group #2 (data) is
characterised by fairly rigid hierarchies with plain character data
inside named fields (often, but not always, short) appearing in
predictable orders.

A standard XML-oriented API like the DOM is entirely suitable for
group #1, but the DOM is probably overkill for group #2, which
requires a domain-specific API (of course, for small or
non-speed-critical applications, the domain-specific API could be
implemented as an adapter on top of the DOM).

That said, you still need some kind of API to get at the XML to
populate the domain-specific model.  Sometimes, the DOM will be
appropriate, but given that many models in group #2 tend to be simple
and need to be processed on busy servers, a light-weight, event-based
API like XML::Parser or SAX usually makes the most sense for that
group.

Ideally, most programmers using XML for group #2 will never see an
XML-specific API -- we should hide it.


All the best,


David

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

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)




More information about the Xml-dev mailing list