[XML-SIG] Interested in feedback
Paul Prescod
paul@prescod.net
Tue, 27 Jun 2000 11:51:08 -0700
Some interesting ideas...to a certain extent, though you should watch
out for reinventing the wheel.
Benjamin Saller wrote:
>
> xml.getValue("container1.allow.host") # == 'loki'
> xml.getValue("container2.allow.host[1]") # == 'foo.bar.com'
What happens if you don't give an index but there are multiple
sub-elements of a type? Do you get a list or the first one?
The "." is a legal XML name character. You could have an element type
named "container1.allow.host."
"/" would be a better choice.
If you do use "/" then you will have reinvented a tiny subset of XPath.
No harm in that: you should probably look at the spec and try to
rationalize your mini-language with it explicitly. I think that Python
1.7 should have an XPath subset in it and this is probably a good start.
Also, insofar as you have an in-memory tree data structure, it might be
better to use a DOM rather than building your own structure using SAX.
--
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