[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [sdo] XML Fidelity issue: xsi:nil with attributes
Hi Guys, I'd like to start discussing some of the XML fidelity issues. The first one, hopefully easy, is to come up with a way to handle nillable elements with attributes. The problem is described in section 2.7 in this doc: http://www.oasis-open.org/apps/org/workgroup/sdo/download.php/26722/SDO_XML_Issues.doc Here is my first thoughts on possible solutions: Option 1: Add a helper method (to XMLHelper or maybe DataHelper if we think this may not be an XML-only issue) to determine if a value is nil: boolean isNil(Object value); This method would return true if value == null or if value is a DataObject with an xsi:nil tag. Users could use it something like this: if (xmlHelper.isNil(myDO.get("someValue"))) { // someValue is nil } Option 2: We could have a method that takes a DataObject and a property path as arguments to determine if a property is nil without actually getting the value: boolean isNil(DataObject object, String path); if (xmlHelper.isNil(myDO, "someValue")) { // someValue is nil } If we go with this approach we would probably want 3 methods: boolean isNil(DataObject object, String path); boolean isNil(DataObject object, Property property); boolean isNil(DataObject object, int index); Option 3: Add the methods to DataObject: boolean isNil(String path); boolean isNil(Property property); boolean isNil(int index); if (myDO.isNil("someValue")) { // someValue is nil } This is nice and clean but would only make sense if we can think of other data domains (other than XML) where the concept of nil (different from null) applies. Please let me know what you guys think about these suggestions, or if you have any other ideas. Thanks, Frank.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]