[Xml-compile] Reading (hooks) according to xsi:type without xsi:type hierarchy
Mark Overmeer
mark at overmeer.net
Wed Nov 4 23:16:55 GMT 2015
* Roman Daniel (roman.daniel at davosro.cz) [151104 16:41]:
> Is it possible to create a reader (hook) respecting the xsi:type blindly,
> i.e. without the hierarchy of xsi:type types? I have a XML schema where
> some elements in schema are xsd:any, while the documents contains xsi:type
> for such elements.
"any" elements and xsi:type are different things. With <any>, you must
expect any kind of element (actually, the documentation tells you what
the options are) Those elements are defined somewhere in some schema.
With xsi:type you can replace the type of an element with an extension
type. It can appear anywhere in your message. Horrible.
> I thought I can create a hook for an element with xsi:type attribute, but I
> found no way to compile a reader for the XML schema type - only for the
> elements. Is it really impossible?
XML::Compile is a compiler... so: it needs to know beforehand what may
appear where. There are a few ways how to do that, probably
$schema->addXsiType is the easiest for you. Find the base-type
which is used in the element definition, and then from the docs
which xsi:type can be expected there and list them. Or try AUTO.
--
success,
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