[XML-SIG] Re: Mr. Nitpicker looks at saxlib
Lars Marius Garshol
29 May 1998 15:18:48 +0200
* Fredrik Lundh
| don't forget the close method;
Ah! Thanks. It's included now.
| what exactly can be returned by the getType method? a string
| describing the type?
| what values can it have?
CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS or
| how should it be used?
To interpret the attribute value. An IDREF is a reference to an ID
declared somewhere else in the document. IDREFS is a list of same.
ENTITY or ENTITIES really means that the attribute value is the name
of an unparsed external entity (or a list in the case of ENTITIES) and
that the application should receive its public and system identifiers.
The DOM level 2 will be required to keep track of all the IDs in a
document so that one can say something like
This will also be necessary in order to support one of the most
important parts of XPointers: the id(...) locator term.
| for kv in attrs.items():
| print "%s=%s" % kv
OK. :-) Support for dictionaries in AttributeList will be extended
Guido (or was it Andrew?) has proposed doing this by making
AttributeList be a subclass of UserDict.UserDict. I think the best way
around this problem is for you to implement AttributeList in C by
subclassing standard dictionaries and then I'll do the same in
Python. (Provided it's possible in a sensible fashion, I haven't
checked this yet.) Maybe Jack can do this in Pyexpat as well?
If you look closely at it (in my translation, I've added a few things)
it's basically a slightly modified hash table with some extra methods
that are trivial to map onto the hash methods. In your case getType
should always return "CDATA" anyway, so it should be easy to
| Hey, everyone should use Python!
Of course! Pardon my temporary lapse into heresy, please. :)
"These are, as I began, cumbersome ways / to kill a man. Simpler, direct,
and much more neat / is to see that he is living somewhere in the middle /
of the twentieth century, and leave him there." -- Edwin Brock