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

Roman Daniel roman.daniel at davosro.cz
Tue Nov 10 09:21:36 GMT 2009


Hi Mark,

I don't think the output is correct - XML::LibXML::Schema->validate also
produces similar error:

unknown-822d808:0: Schemas validity error : Element
'{http://myns.cz/}inner<http://myns.cz/%7Dinner>':
'' is not a valid value of the local atomic type.

The reason why we need to distinguish between empty and missing element is
that our real schema actually describes a XML form  of UPDATE SQL statement,
with the meaning

- element is not present, column is not changed
- element is present, column is changed (to NULL if xsi:nil=3D"true", to em=
pty
string if element is empty - we use Oracle DB so for us it is the same).

Roman


2009/11/9 Mark Overmeer <mark at overmeer.net>

>
> Hi Roman,
>
> Nillable in combination with minOccurs=3D0 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=3Dtrue" 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 =3D { inner =3D> $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=3D"true" and minOccurs=3D"0".
> >
> > NILLABLE:
> > <?xml version=3D"1.0"?>
> > <x0:outer xmlns:x0=3D"http://myns.cz/"/>
> >
> >
> > NILLABLE: nillable=3D"true"
> > <?xml version=3D"1.0"?>
> > <x0:outer xmlns:x0=3D"http://myns.cz/" xmlns:xsi=3D"http://www.w3.org/2=
001/
> > XMLSchema-instance">
> >   <x0:inner></x0:inner>
> > </x0:outer>
> >
> > error: string `' does not have minimum length 1 at {
> http://myns.cz/}outer/inner <http://myns.cz/%7Douter/inner>
> > #facet
> --
>               MarkOv
>
> ------------------------------------------------------------------------
>       Mark Overmeer MSc                                MARKOV Solutions
>       Mark at Overmeer.net                          solutions at overmeer.net
> http://Mark.Overmeer.net                   http://solutions.overmeer.net
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20091110/dc=
83633f/attachment.htm


More information about the Xml-compile mailing list