Skip to Content.
Sympa Menu

mace-opensaml-users - Re: Detecting "xsi:nil" in AttributeValue

Subject: OpenSAML user discussion

List archive

Re: Detecting "xsi:nil" in AttributeValue


Chronological Thread 
  • From: Brent Putman <>
  • To:
  • Subject: Re: Detecting "xsi:nil" in AttributeValue
  • Date: Fri, 14 Mar 2008 05:31:46 -0400

No, agreed, I wasn't proposing we change it now (too close before 2.0), just presenting what seems to me to be the most straightforward approach.


Chad La Joie wrote:
We are not changing the API at this point.

Brent Putman wrote:


Unless Chad has a better idea, I think the only workable way is to in fact put in on XMLObject, with the other xsi attributes. Of course, only those which are actually nillable could ever set it to true without causing schema violation, but we don't strictly prevent people from shooting themselves in the foot anyway.

So I'd propose:
1) put isNil/setNil on XMLObject, defaulting to false
2) marshaller only expresses it on the marshalled element if it's true
3) unmarshaller would unconditionally set it if it's present on the element, and hope that it is in fact valid for the element being unmarshalled. Don't know what else you could do. If schema compliance is really important, then I suppose you just have to schema validate when parsing.

If we want to be really anal and provide a safety net mechanism to prevent people from inadvertently doing the bad thing when creating objects, then we could also:
4) add an isNillable/setNillable to XMLObject, defaulting to false
5) implement setNil so that if isNillable is false, throws an illegal argument exception or something
6) actual defined elements/types (i.e. that are not anyType cases) which are nillable could just set to true in the constructor, etc
7) anyType cases like AttributeValue would just set to true externally, on construction, perhaps in the builder if a custom builder is used.





Archive powered by MHonArc 2.6.16.

Top of Page