[Xml-compile] Schemas with mixed elements

Drew Taylor drew at drewtaylor.com
Tue Aug 12 09:36:27 BST 2008


On 11 Aug 2008, at 20:12, Mark Overmeer wrote:

> * Drew Taylor (drew at drewtaylor.com) [080811 17:16]:
>>
>
> mixed elements are a pain, because... they are not structured as a
> HASH or ARRAY... a mixed mess.

Indeed they are!

> You have (since release 0.89) the
> options
>  . mixed_elements => STRUCTURED
>    to ignore the "mixedness" of them (may make exceptions with hooks)
>    ignoring the text between elements.

 From my code diving yesterday, it's worth mentioning that the  
mixed_elements => STRUCTURED option stops everything for the Writer.   
It would be useful to have since on my requests I have no mixed  
content and can easily ignore what's not there. Actually, I had a  
question about this code in Translate::Writer::makeMixedElement():

   elsif($mixed eq 'STRUCTURAL')
   { # mixed_element eq STRUCTURAL is handled earlier
     panic "mixed structural handled as normal element";
   }

Where is STRUCTURAL handled earlier? I didn't see anything obvious  
from the stack trace.

> Both nicely structured. In most schema's I have seen, "mixed" was  
> abused.

Unfortunately the responses do have mixed content. IMHO the schema I'm  
working with is very complicated, in contrast with the large but sane  
schema (TORIX) we're using at $work for our API. Luckily I'm only  
implementing two of the messages.

<Price Role="Supplement">blah blah<Segment Ref="CELASSGS"/>
   <Amounts>
     <Amount Quantity="1" Target="Unit" Value="3000"/>
     <Amount Target="Total" Value="3000"/>
   </Amounts>
</Price>

>> Is there a
>> shortcut I can use to reduce the boiler plate I'd be using to  
>> generate
>> the XML nodes? How are other people handling mixed schemas?
>
> XML::Simple::XMLout() ?   Probably not.

Interesting idea. I think XML::LibXML::Simple could be useful on the  
server side to generate the request. I might see the effort involved  
in writing XML::LibXML::Simple::XMLout()...

Drew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20080812/ea8d8c9e/attachment.htm


More information about the Xml-compile mailing list