[XML-SIG] XmlProc and the ANY element

Daniel Shane shane@irosoft.com
Fri, 26 Jul 2002 14:30:36 -0400


Hi everyone,

I am currently building an application using xmlproc and have found that =
I=20
need to know what are the next valid elements even when the content model=
 is=20
ANY. In its current state XMLProc returns the empty list and although som=
e=20
may have built applications that expect this behavior I think it should=20
really return the list of all the valid DTD elements.

I am sending this email to gather if anyone else had this need in the pas=
t and=20
how it was handled. If a good solution pops out of this thread, I am sure=
=20
Lars would include a patch to change the behavior of the ElementAny.

To start the flames (oups... I meant process!) here are the three solutio=
ns I=20
propose:

a) Change the automaton to physically have steps from ANY to all elements=
,=20
therefore eliminating the special ElementAny class (I am not sure this is=
=20
possible...) at the same time. This would mean that the parsing of the DT=
D=20
would have two steps, first it would parse the DTD to detect all the=20
elements, and after it would re-parse it to build the elementType objects=
=20
using the list of the DTD elements built in the first pass to convert the=
 ANY=20
to standard ElementType objects.

b) Catch the current elementType is the main program and call a function =
on=20
the dtd which would return the list of all elements if the type is ANY. T=
his=20
would not break the current implementation but is a bit of a hassle for t=
he=20
programmer. =20

c) Keep a reference to the dtd in the ElementType ANY and return dtd.get_=
elems=20
(or the equivalent). With the advent of Python 2.x this should not leak=20
memory but we would need an unlink, which is not that nice.

Please feel free to comment on these!

Regards,
Daniel Shane
--
Daniel Shane
Programmeur Analyste, IROSoft inc.
web: http://www.irosoft.com
email: shane@irosoft.com=20