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

Mark Blackman m.blackman at fairfx.com
Tue Jun 29 21:28:57 GMT 2010


On 29 Jun 2010, at 22:13, Mark Overmeer wrote:

> * 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.


Thanks, I had a feeling you would say something like this. While the message
could be poorly defined, in fact, I'm pretty sure that <invoices> will always
be an "array" and <invoice> will always be a complex type with those elements
of a simple type. I was just irritated at how the type attribute fouled up
the hash reference nesting (from the Trang-generated schema).

Cheers,
Mark




More information about the Xml-compile mailing list