Hi,

is there any possibility to find out if an element's nil attribute was set to 
true or if the element was omitted.

Here is an example of what I want:

xml-schema:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:element name="Root">
    <xs:complexType>
    <xs:sequence>
        <xs:element name="User" minOccurs="0" nillable="true" type="UserType"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>

    <xs:complexType name="UserType">
    <xs:sequence>
        <xs:element name="Address" minOccurs="0" maxOccurs="5" 
type="AddressType"/>
    </xs:sequence>
    </xs:complexType>

    <xs:complexType name="AddressType">
        <xs:sequence>
            <xs:element name="Street" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

binding:

<binding name="binding" package="user" trim-whitespace="true">
  <mapping class="user.Root" name="Root">
    <structure map-as="UserType" get-method="getUser" set-method="setUser" 
usage="optional" name="User" nillable="true"/>
  </mapping>
  <mapping abstract="true" type-name="UserType" class="user.UserType">
    <collection get-method="getAddressList" set-method="setAddressList" 
usage="optional" create-type="java.util.ArrayList">
      <structure map-as="AddressType" name="Address"/>
    </collection>
  </mapping>
  <mapping abstract="true" type-name="AddressType" class="user.AddressType">
    <value style="element" name="Street" get-method="getStreet" 
set-method="setStreet"/>
  </mapping>
</binding>

I generated binding and class files out of xsd and added nillable=true to 
User-element (this was not generated automatically). Additionally I would 
expect a method like: isNilUser or somthing like that at Root-Level. Then I 
thought I could add a boolean flag "userWasSet" to Root and set it to true if 
setUser is called. So I could find out if it's nil --> user = null and setUser 
= true. But setUser is also called if tag is omitted.

Thanks for any help

kind regards
Nikolaus Graf




------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to