[XML-SIG] DOM API
Paul Prescod
paul@prescod.net
Mon, 26 Apr 1999 15:10:36 -0500
I'll have to think about some things more than I have time for right now.
Other stuff:
uche.ogbuji@fourthought.com wrote:
>
>
> We might consider this for Namespace support for 4DOM, although we had been
> planning to wait for W3C to jump, so that we could maintain
> standards-compliance. Right now 4DOM just treats namespaces entirely
> opaquely, i.e. ignores them. Maybe there is a way to add your above
> suggestions to DOM.Ext.
In response to Greg's comments, I'm starting to think that namespace
processing should be a mode: either completely on or completely off. The
complex, scoped namespaces mechanism is more the result of politics than
technology -- this wasn't how namespaces were supposed to turn out.
> > element.getText: returns a list of deep list of data from the text nodes.
> > Do your own string.join to choose an appropriate join character.
>
> I'm not sure how useful this is if we omit the semantics of
> nested elements.
Actually, it gets a fair amount of use and is easy to implement. DSSSL,
XSL and the grove paradigm all provide this feature. Consider:
<SECTION>
<TITLE>This is the <CODE>XSL</CODE> introduction.</TITLE>
...
</SECTION>
Now I'm generating a TOC, index or cross-reference. I don't care abou the
CODE element -- I just want to treat it as if the tags doen't exist.
I could go either way on this function, though.
> I would see more use for a method that simply returns the XML text within an
> element, including nested tags.
That's a different feature that is also useful.
> > element.getChild("FOO") returns the first child (not descendant) element
> > with specified element type name.
>
> I've never had a need for such a method. I often need all such elements, in
> which case I just use getElementsByTagName.
I'm surprised that you've never needed it. In Greg's data-ish world it
would be incredibly useful but also in the data-ish subsets of the
document world.
<DOCUMENT>
<METADATA>
<TITLE>Blah...</TITLE>
<AUTHOR>Blah...</AUTHOR>
</METADATA>
...
</DOCUMENT>
doc.documentElement.getChild( "METADATA" ).getChild( "AUTHOR" )
You can emulate this with getElementsByTagName but you incur the overhead
of building and discarding the node list.
> > element.getChild( "#PCDATA" ) gets a list of child text nodes.
I've never needed this one, but Greg seems to...we'll let him defend it
(here or in qp_api) when he gets back.
--
Paul Prescod - ISOGEN Consulting Engineer speaking for only himself
http://itrc.uwaterloo.ca/~papresco
Company spokeswoman Lana Simon stressed that Interactive
Yoda is not a Furby. Well, not exactly.
"This is an interactive toy that utilizes Furby technology,"
Simon said. "It will react to its surroundings and will talk."
- http://www.wired.com/news/news/culture/story/19222.html