[Xml-compile] writer and element with nillable="true" minOccurs="0"

Mark Overmeer mark at overmeer.net
Mon Nov 9 21:29:51 GMT 2009


Hi Roman,

Nillable in combination with minOccurs=0 is a tricky combination. They
are both "missing", respectively explicitly and implicitly. That's a
bit double. I do not know whether it is possible to reimplement the layer
for "nillable=true" to produce the same output as without that option...

The output in either case is correct, because an empty element must
be interpreted as missing element.  So, the error message is the bug.

You can easily avoid the problem by explicit use of the NIL version.
  $data = { inner => $v // 'NIL' }

Can you please add this in rt.cpan.org?  (no extra info needed)

* Roman Daniel (roman.daniel at davosro.cz) [091109 16:42]:
> I encounter a strange (for me) behaviour of XML::Compile::Schema (1.07)
> regarding the combination above.
> 
> I have an outer element of complex type (sequence) and inner element having
> nillable="true" and minOccurs="0".
> 
> NILLABLE:
> <?xml version="1.0"?>
> <x0:outer xmlns:x0="http://myns.cz/"/>
> 
> 
> NILLABLE: nillable="true"
> <?xml version="1.0"?>
> <x0:outer xmlns:x0="http://myns.cz/" xmlns:xsi="http://www.w3.org/2001/
> XMLSchema-instance">
>   <x0:inner></x0:inner>
> </x0:outer>
> 
> error: string `' does not have minimum length 1 at {http://myns.cz/}outer/inner
> #facet
-- 
               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