[Xml-compile] Re: XML::Compile question

Mark Overmeer mark at overmeer.net
Wed Oct 10 14:08:44 GMT 2012


* Tristan Crockett (tristan at leadkarma.com) [121010 14:00]:
> <xs:element name="el">
>         <xs:complexType>
> 		<xs:choice>
> 			<xs:element ref="one"/>
> 			<xs:sequence>
>                                 <xs:element ref="one"/>
> 				<xs:element ref="two"/>
> 			</xs:sequence>
> 		</xs:choice>
>        </xs:complexType>
> </xs:element>

> 
> This problem is easy to get around if you have write access to the
> schema, but that is not the case here. So I have a few questions:
> 
> 1. Is the above behavior expected, or a bug?

I think this is a bug in the schema.  The message processors must
be able to go step by step through the structure; one a step is
consumed there is no way back.

The correct way to write above is

  <xs:element name="el">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="one"/>
        <xs:element ref="two" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

> 2. Is there any way to craft the hash or choose a compile option to
> hint/force XML::Compile to choose the sequence in the second case?

Fix the schema.  (It is not unusual that schema's are broken)
-- 
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