[Xml-compile] Ordering causes Reader to fail ?

Mark Overmeer solutions at overmeer.net
Wed Oct 3 07:07:12 GMT 2012


* Anthony Wood (bessington at gmail.com) [121003 01:07]:
> alto  =>  Layout => Page =>  PrintSpace => TextBlock => TextLine =>
> <String/><SP/>...
> 
> If there are *any *TextLines which match the following, the file is
> rejected with the error above
> alto  =>  Layout => Page =>  PrintSpace => TextBlock => TextLine =>
> <SP/><String/>...

>                     # sequence of String, SP
>                     # occurs 1 <= # <= unbounded times

The example leads me back to:

  <sequence minOccurs="1" maxOccurs="unbounded">
    <element name="String" type="x0:StringType" />
    <element name="SP" minOccurs="0"><attributes>....
  </sequence>

Logically, the String and following SP (white-space) are tied together.
This forgets the situation that the list starts with a SP.  And why tie
them together in the first place?  Replace it with

  <choice minOccurs="1" maxOccurs="unbounded">
    <element name="String" type="x0:StringType" />
    <element name="SP"><attributes>....
  </choice>

This does accept a bit more, for instance <SP><SP>, but unties the
strict relation.

It is possible to patch bugs in schema's by simple overriding elements
in the schema:

  $schema->importDefinitions(<<'__PATCH')
  <schema ...>
    <element .... />
  </schema>
  __PATH

The last definition for a type or element wins.

The official rule of XML is: if it does not validate, then reject the
whole message.  It is a good rule: the breaker of the standard gets
punished.  However... :(
-- 
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