Title: RE: nillable, fixed and default XSD attributes

Thanks for the answer.
I will give it a shot in the Xerces mailing list.
I tried as well with the parser/validator of Microsoft .NET and the behavior is the same. I am probably missing something in the XML Schema spec, but I cannot find it....

Thomas

-----Original Message-----
From: David N Bertoni/Cambridge/IBM [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 19, 2003 12:07 PM
To: [email protected]
Subject: Re: nillable, fixed and default XSD attributes





Hi Thomas,

Your best bet is to create a minimal shema document and instance document
that illustrates your question and post that to the Xerces list.

I agree with you this seems confusing, since Xerces is adding the
default/fixed attribute, then complaining the element must be empty, but
I'm not enough of a schema expert to know the right way to handle this
situation.

Dave



                                                                                                                                

                      [EMAIL PROTECTED]                                                                                  

                      oftware.com                      To:      [email protected]                                    

                                                       cc:      (bcc: David N Bertoni/Cambridge/IBM)                            

                      03/19/2003 07:58 AM              Subject: nillable, fixed and default XSD attributes                      

                                                                                                                                



I recognize that it is more a pure XML question than a Xalan one, but just
in case someone has a good answer for me.

When looking at the XML Schema specification, if you declare an element
with
nillable="true", you cannot use the fixed attribute (which, I guess makes
sense).
I did not find anything related to nillable="true" and the usage of a
default value.

By using the Xalan sample programs, here is what I found by experimentation
(more a Xerces test than a Xalan one, I suppose): if I have either a
default
or fixed attribute on my element declaration, as well as nillable="true",
no
errors are generated at the schema processing time, but when processing an
XML document, if it contains an empty element instance with xsi:nil="true",
then I get an error (Element [element name] with attribute xsi:nil=true
must
be empty).

I understand the behavior when I have the fixed attribute (although an
error
at schema processing time will be better), but I am not sure I understand
this behavior when I have the default attribute as the XML schema does not
seem to say that it is not allowed.

Any ideas? Did I miss something in the XML schema spec or is there a
potential Xerces bug?

Thomas

Reply via email to