[XML-SIG] Reconsidering the DOM API

Paul Prescod paul@prescod.net
Tue, 27 Jun 2000 12:11:14 -0700

Michael McLay wrote:
> ..
> a=b.get_childNode(0).get_attribute("abc")

How do you get the list of childnodes and attributes?
> or perhaps the call chain should be reduced by merging methods:
> c = b.get(childNode=0, attribute="abc")

How about childNodes[0].childNodes[1].childNodes[0].attributes["abc"]

> The standard Python interface may end up having to support both access
> approaches (direct and through methods), which will really make the
> interface ugly.  

That's the status quo!!!!

> If we had to choose one, which one will allow the
> greater flexiblity?

Neither. Python attribute accesses can really be method calls and python
method calls can really be attribute accesses. That's why I love Python.

> Benjamin Saller "getValues" idea looks interesting.  Perhaps it is
> time to step back and ask how easy XML could be if the Python
> interface had nothing to do with SAX or DOM.

We have already done so. I've seen around 7 or 8 APIs for Python XML.
There was no *general purpose* API that was significantly easier than
the DOM. If you restrict your problem domain (e.g. no editing, no
character data, etc.) then you can make easier APIs.

The whole reason we are arguing about this is because some people like
the DOM *so much* that they want to apply it to non-XML information like
ZObjects. All we disagree on is trivial syntactic issues. In my opinion,
going back to first principles would be, well, going backwards.

 Paul Prescod - Not encumbered by corporate consensus
When George Bush entered office, a Washington Post-ABC News poll found
that 62 percent of Americans "would be willing to give up a few of the
freedoms we have" for the war effort. They have gotten their wish.
	- "This is your bill of rights...on drugs", Harpers, Dec. 1999