[XML-SIG] xmlproc DTD api bug
Lars Marius Garshol
24 Oct 2000 18:26:28 +0200
* Alexandre Fayolle
| I'm using PyXml 0.5.5.1 on python 1.5.2 I know these are old
| versions (we are planning to move further real soon now), so maybe
| the problem has already been fixed. Please excuse me if this is the
It has been fixed, but not in the PyXML package. The fix will appear
there when I move xmlproc development to the PyXML CVS tree.
| If I have an element with an ANY content model, and use
| elt.get_valid_elements(elt.get_start_state()), I get a Type Error,
| because the content model is None for this element:
| File "/usr/lib/python1.5/site-packages/xml/parsers/xmlproc/xmldtd.py",
| line 300, in get_valid_elements
| return self.content_model[state].keys()
| TypeError: unsubscriptable object
| I think xmlproc should test for this case,
I agree, and the version in my CVS tree does. It might be that
version 0.70 also does; I'm not sure.
| and return the list of all the elements known in the DTD (using
In principle I agree that this would be the correct solution.
However, the element doesn't have a reference to the DTD, so it
doesn't have this information. So my current code returns ''
The problem is that if the element is to have a reference to the DTD
we have a cycle and in 1.5.2 that means that we must have either a
.unlink() method on the DTD or memory leaks (and quite often also
If you want to fix the immediate problem, add this method to the
ElementTypeAny class in xmldtd.py:
def get_valid_elements(self, state):
Thank you for reporting this problem!