[XML-SIG] XmlProc and the ANY element

Lars Marius Garshol larsga@garshol.priv.no
30 Jul 2002 23:46:55 +0200


* Daniel Shane
| 
| a) Change the automaton to physically have steps from ANY to all
| elements, therefore eliminating the special ElementAny class (I am
| not sure this is possible...) at the same time.

This is possible, but would require the automatons for ANY content
models to be computed only when the entire DTD has been parsed. And it
wouldn't work for DTDs generated using the API (well, that might not
work anyway).

It would have a performance impact, however, and it would cause
certain complications, so I think I would discourage this approach.

| This would mean that the parsing of the DTD would have two steps,
| first it would parse the DTD to detect all the elements, and after
| it would re-parse it to build the elementType objects using the list
| of the DTD elements built in the first pass to convert the ANY to
| standard ElementType objects.

Well, you can just make a list of all elements with ANY content
models, and then run over that at the end. Reparsing the DTD would be
quite costly (think of DocBook!), so I would prefer to avoid that.
 
| b) Catch the current elementType is the main program and call a
| function on the dtd which would return the list of all elements if
| the type is ANY. This would not break the current implementation but
| is a bit of a hassle for the programmer.

I guess this is what people do now. I think Alexandre Fayolle had this
very issue a while ago. I'd be interested to see what he says.
 
| c) Keep a reference to the dtd in the ElementType ANY and return
| dtd.get_elems (or the equivalent). With the advent of Python 2.x
| this should not leak memory but we would need an unlink, which is
| not that nice.

I think this is the best solution, though what is worst of the disease
and the cure I am not sure. :-)

-- 
Lars Marius Garshol, Ontopian         <URL: http://www.ontopia.net >
ISO SC34/WG3, OASIS GeoLang TC        <URL: http://www.garshol.priv.no >