[Xml-compile] How to read an abstract element with xsi:type attribute?

Mark Overmeer mark at overmeer.net
Sat Dec 19 16:00:12 GMT 2009


* Roman Daniel (roman.daniel at davosro.cz) [091219 15:10]:
> while parsing xml with abstract element substituted by concrete one I run into
> a problem how to read:
> 
> <myabstractns:myAbstractElem xsi:type="myconcretens:myConcreteType attr=
> "value">
> ...some content
> </myabstractns:myAbstractElem>

xsi:type is not (yet) supported. Since a few years, we have the much
nicer concept of substitutionGroups. That solves the problem of xsi:type
which can be used everywhere. For a "compiler", the "xsi:type" is a
horror: for instance, where the schema specifies a long, it should
expect any type which is derived from a long on that location!  And for
an "any" it is of course much worse.  Gladly, only a few schema's do
use it, nowadays.

I have been thinking of some solution, where the application developer
helps XML::Compile by creating a kind of manual substitionGroup. Something
like:

  xsistypes =>
    { "{$ns}abstract" =>
         [ "{$ns}ext1", "{$ns}ext2", ... ]

As said: xsi:type is quite rare, nowadays.  So it las a low priority
on the moment. There is a t/74type.t already, but waiting for the
implementation.
-- 
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list