|
There is an earlier discussion on this
topic, please see: http://www.mail-archive.com/[email protected]/msg00512.html Cezar From: Samuel B.
Quiring [mailto:[EMAIL PROTECTED] Greetings, I have a schema fragment that looks like this: <xs:complexType
name="HumanNameDataType"> I'm calling validate() to verify the java object
after I fill it with values. For the three fields with
minOccurs="0", if I set value to null validate returns this error: validation error: <xml-fragment
xmlns:glob="http://apply.grants.gov/system/GlobalLibrary-V1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<glob:PrefixName>Dr.</glob:PrefixName>
<glob:FirstName>Emmet</glob:FirstName> <glob:MiddleName>T</glob:MiddleName>
<glob:LastName>Brown</glob:LastName> <glob:SuffixName
xsi:nil="true"/> </xml-fragment>,[EMAIL PROTECTED] [EMAIL PROTECTED] validationerror: error: cvc-elt.3.1: Element has xsi:nil attribute but is not
nillable To deal with this I tried setting the value 3
different ways: name.setSuffixName(null); -- see above
error name.setSuffixName("");
-- min string length must be 1 do nothing --
this works. Only if I did nothing did validate() report no
errors. What is the difference between setting a value to
null and not setting a value at all? Is there a configuration parameter I
can use to say "setting a value to null is the same as not setting
it?" Is this behavior documented somewhere? I
searched the docs but couldn't find anything, but I probably missed it. -Sam |
- RE: nilable and validate() Cezar Andrei
- Re: nilable and validate() Samuel B. Quiring

