hi dennis,

by the way after i changed the way to use collections as i described in my other thread, i get the nillable problem to work. here's my binding that works now during runtime:

<?xml version="1.0" encoding="ISO-8859-2"?>
<binding direction="input">
        <mapping name="customer" class="simpledata.Customer"
                ordered="false" flexible="true" allow-repeats="true" >
                <value name="id" field="id" />
                <value name="first" field="firstName" nillable="true"/>
                <value name="last" field="lastName" nillable="true"/>
<structure name="address" ordered="false" type="simpledata.Address" set-method="addAddress" allow-repeats="true"/>
        </mapping>
        <mapping class="simpledata.Address" abstract="true" flexible="true"
                ordered="false">
                <value name="id" field="id"/>
                <value name="street" field="street" usage="required" 
nillable="true"/>
                <value name="city" field="city" usage="required" nillable="true" 
/>
                
        </mapping>
</binding>

maybe that helps in finding the original problem.

br,
guenther

Am 31.07.2007 um 10:05 schrieb Günther Wieser:

hi dennis,

thanks for your investigations, good to know that i wasn't completely wrong ;-)

br,
guenther

Am 31.07.2007 um 03:55 schrieb Dennis Sosnoski:

Hi Günther,

First off, the documentation is incorrect in not listing the nillable
attribute for the <value> element. It looks like there's some sort of
glitch in the generated code when it comes to unmarshalling these
values, though - you shouldn't get that parser error that you're seeing.
From a quick look at my test cases it looks like I didn't try out the
case of a nillable <value> following another <value> (only as the first thing inside a <structure> or <collection>), and that's probably leaving
the parser in the wrong state. I'll investigate this.

Thanks,

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



Günther Wieser wrote:
hi,

i found some confusing information regarding the usage of xsi:nil to
indicate if an obejct or value is null.

on the mailing list i found the following entry:

[jibx-users] JiBX 1.1 beta4 release
Dennis Sosnoski
Thu, 25 May 2006 21:26:05 -0700

4. Added nillable attribute to object group and value element,
supporting the xsi:nil attribute at runtime (requires element name,
not allowed on abstract mapping)

in the docs i found out that the value element doesn't support
nillable=true. interestingly i can add that to my binding and it
compiles well. but when it comes to runtime, i get a weird exception:

java.lang.IndexOutOfBoundsException: only START_TAG can have
attributes END_TAG seen ...</street>\r\n\t\t<city xsi:nil="true" / >...
@10:26
at org.xmlpull.mxp1.MXParser.getAttributeValue(MXParser.java:927)
at
org.jibx.runtime.impl.XMLPullReaderFactory $XMLPullReader.getAttributeValue(XMLPullReaderFactory.java:395)
at
org.jibx.runtime.impl.UnmarshallingContext.getAttributeValue (UnmarshallingContext.java:356)
at
org.jibx.runtime.impl.UnmarshallingContext.attributeBoolean (UnmarshallingContext.java:1881)
at
data.Address.JiBX_C__JavaDev322_JiXB_Test_src_customer_binding_unmar shal_1_1(Address.java)
at
data.Customer.JiBX_C__JavaDev322_JiXB_Test_src_customer_binding_unma rshal_1_2(Customer.java)
at
data.JiBX_C__JavaDev322_JiXB_Test_src_customer_bindingCustomer_acces s1.unmarshal()
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalElement (UnmarshallingContext.java:2537)
at
org.jibx.runtime.impl.UnmarshallingContext.unmarshalDocument (UnmarshallingContext.java:2680)
at test.CustomerWAddressTest.main(CustomerWAddressTest.java:23)

i don't get this is i remove 'nillable=true' from the binding, but
then of course the value is not null, it's an empty string (which
means something different in our case).

here's the binding:
<?xml version="1.0" encoding="ISO-8859-2"?>
<binding>
<mapping name="customer" class="data.Customer" flexible="true"
ordered="false" allow-repeats="true">
<value name="id" set-method="setJiXBId" get-method="getJiXBId"/>
<value name="first" set-method="setJiXBFirstName"
get-method="getJiXBFirstName"/>
<value name="last" set-method="setJiXBLastName"
get-method="getJiXBLastName"/>
<!-- <collection field="addresses" flexible="true" ordered="false"> -->
<structure name="address" type="data.Address" allow-repeats="true"
flexible="true" ordered="false" set-method="addAddress"
get-method="getAddress">
<value name="id" set-method="setJiXBId" get-method="getJiXBId"/>
<value name="street" set-method="setJiXBStreet"
get-method="getJiXBStreet" usage="optional"/>
<value name="city" set-method="setJiXBCity" get-method="getJiXBCity"
usage="optional" nillable="true"/>
</structure>
<!-- </collection> -->
</mapping>
</binding>

and here's the example data:
<?xml version="1.0" encoding="ISO-8859-2"?>
<customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
<id>1234</id>
<first>Heinz</first>
<last>Prueller</last>
<asdasd>asasd</asdasd>
<address>
<id>111</id>
<street>Daham 1</street>
<city xsi:nil="true" />
</address>
</customer>

so do i need to change something in my binding? could i use structure
instead of value (and if how can i do that)?

br,
günther

--
Günther Wieser


-------------------------------------------------------------------- ----

-------------------------------------------------------------------- -----
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
-------------------------------------------------------------------- ----

_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users


--------------------------------------------------------------------- ----
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users





--
Günther Wieser
openForce Information Technology GesmbH
Plenergasse 1
A-1180 Wien

[EMAIL PROTECTED]
http://www.openforce.com








--
Günther Wieser
creative-it
Guglgasse 6/1/11/1
A-1110 Wien
[EMAIL PROTECTED]
http://www.creative-it.com


---------------------------------------------------------------------- ---
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users



--
Günther Wieser
openForce Information Technology GesmbH
Plenergasse 1
A-1180 Wien

[EMAIL PROTECTED]
http://www.openforce.com








--
Günther Wieser
creative-it
Guglgasse 6/1/11/1
A-1110 Wien
[EMAIL PROTECTED]
http://www.creative-it.com


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to