OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Confusion while implementing the DOM.

[ Lists Home | Date Index | Thread Index ]
  • From: Andrew Douglas <andrew.douglas@netcentric-solutions.com>
  • To: xml-dev@ic.ac.uk
  • Date: Wed, 2 Jun 1999 12:09:10 +0100 (BST)


I've been given the job of implementing a web-content management tool.
We (I) have decided that valid XML documents are, at the moment, the
best way to go.  So I've been building my own classes for implementing
XML and DTDs, and have added the DOM as one of the features I want to

Now, I know the DOM is independent of the implementation of XML documents,
but my question is, how closely can I reveal my implementation through
the DOM?  Consider a simple DTD:

  <!Element root (elone, eltwo)*>
  <!Element elone (#PCData)>
  <!Element eltwo (#PCData)>

A simple document meeting this would look as so:

    <elone>Gutten Adbend</elone>

My underlying structure looks like this

            sequence                      sequence
         |------+-----|                |------+-------|       
 opentag(elone) opentag(eltwo) opentag(elone) opentag(eltwo)
       |               |              |             |   
     text            text           text          text
Not suprisingly, it looks like a tree!  So, all these things can be
Nodes, but not all are Elements (opentags are) -- some are
probably DocumentFragments(zomcontent, sequence, ...).

So, my DOM implementation has the usual first/last Child, getChildNodes,
get Next/Previous siblings, and so on, but sometimes these children aren't
Elements, but are DocumentFragements.

Also, taking the above tree as an example, each opentag(elone) has a single
NextSibling, but no PreviousSibling (and vice versa for opentag(eltwo)s).
Please can someone tell me if this acceptable?  The books/Spec don't really
say that much about it all.


PS The only one I've probably implemented correctly is getNodesByTagName,
which returns a NodeList guaranteed to contain only Elements.

Andrew Douglas,               andrew.douglas@netcentric-solutions.com
Netcentric, Unit 3, Copley Hill Farm,Cambridge Road,Cambridge,CB2 4AF
http://dougie1111.ecode.com/ ;-)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS