[Xml-compile] some kind of default schema for a REST XML interface

Mark Overmeer mark at overmeer.net
Tue Jun 29 21:13:25 GMT 2010


* Mark Blackman (m.blackman at fairfx.com) [100629 20:58]:
> It tends to typecast the elements via an element attribute (type) like so:
> <?xml version="1.0" encoding="UTF-8"?>
> <invoices type="array">
>   <invoice>
>     <id type="integer">85</id>
>     <contact-id type="integer">10</contact-id>
>     <project-id type="integer">16</project-id>
>     <dated-on type="datetime">2008-02-17T00:00:00Z</dated-on>
  ...

> However, I wonder if XML::Compile has any nice way of handling this
> kind of XML where simple type information is already encoded in
> the original XML instead of being delegated to an external schema.

If there is no schema, then the message is not well defined. That means,
for instance, that you cannot predict whether elements repeat or may
nest. So, the fields may get validated some way (above types are NOT
schema defined types) but that is still a very weak message definition.

XML::Compile::RPC uses a home-brew schema to do about the same as the
above.

Probably, the only way to read these messages is via XML::Compile::Simple
or XML::Simple. To create these messages will require node-by-node
processing.
-- 
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