Standard interface for DOM building

Tyler Baker tyler at infinet.com
Fri Sep 25 15:17:48 BST 1998


Michael Kay wrote:

> There are a number of DOM implementations now appearing,
> (for example a new one from SUN) and I have been trying to
> add support for them to SAXON. The thing that's missing is a
> standard interface to build the Document. Can XML-DEV step
> in to fill the gap?

This seems like a good idea.  One thing I do in the DOM implementation I have is
to pre-index all of the elements for each tag name into NodeLists and then store
them in a table.  The reason for this was that for some applications like XSL
Processors which need to be able to extract elements by name through
Element.getElementsByTagName(String name), this operation can be costly if done
repeatedly without any sort of indexing.  Even though the DOM interfaces are
standard, I think that some sort of context interface would help for application
developers so that they can make assumptions like: Are the values returned from
Node.getNodeName() internalised strings or not?  Other things application
programmers might want to know (that are not covered in the spec) are questions
like: can the DOM tree be indexed?

The two main solutions I have identified are:

(1) Have a DOM Document Factory and get initialization parameters via system
properties in a manner similiar to how SAX's Parser Factory looks up the value
returned from org.xml.sax.parser to get the class name for the SAX parser.

(2) Specify that particular DOM Document implementation look up certain
properties upon initialization and understand how to initialize themselves for
whatever environment they are configured for.

Right now the most standard way for DOM Document support that I can think of is
to make sure that you have at least one constructor be an empty constructor.

Regards,

Tyler


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