hi maria,

i opened a bug for that in the codehaus jira for jibx. did this a few  
months ago, so far this bug has not been opened by the developers,  
unfortunately.

we overcome this problem in our production systems by writing our own  
unmarshaller so that we could use a structure tag instead of the value  
tag. using structure plus our own unmarshaller solved this, the  
unmarshaller of course is quite easy as long as you can easily detect  
your datatypes coming easily (you need to create the correct datatype  
from an input string, our datatypes were able to do that already).

if you need more details let me know, i could post some demo code if  
you need it (but it will take until tuesday as monday is off here at  
my place).

br,
günther

Am 21.03.2008 um 11:18 schrieb Maria Aschauer:

> hi,
> i am facing the same problem now, is there any solution?
>
> lg maria
>
> Günther Wieser schrieb:
>> hi,
>>
>> we found a problem with using nillable="true" and optional="true" on
>> the very same value tag.
>>
>> think about the following example binding:
>> <?xml version="1.0" encoding="ISO-8859-2"?>
>> <binding>
>>      <mapping name="Data" class="usageoptreq.UsageOptReqData"
>>              ordered="false" flexible="true">
>>              <value name="optional1" field="optional1" nillable="true"
>> usage="optional"/>
>>              <value name="optional2" field="optional2" nillable="true"
>> usage="optional"/>
>>              <value name="optional3" field="optional3" nillable="true"
>> usage="optional"/>
>>              <value name="optional4" field="optional4" nillable="true"
>> usage="optional"/>
>>      </mapping>
>> </binding>
>>
>>
>> we get the following error during runtime (compilation works fine):
>>
>> java.lang.IndexOutOfBoundsException: only START_TAG can have
>> attributes TEXT seen ...<optional1>OO Optional1<... @6: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
>> usageoptreq
>> .UsageOptReqData.JiBX_binding_unmarshal_1_2(UsageOptReqData.java)
>>      at usageoptreq.JiBX_bindingUsageOptReqData_access.unmarshal()
>>      at
>> org
>> .jibx
>> .runtime
>> .impl 
>> .UnmarshallingContext.unmarshalElement(UnmarshallingContext.java:
>> 2537)
>>      at
>> org
>> .jibx
>> .runtime
>> .impl 
>> .UnmarshallingContext.unmarshalDocument(UnmarshallingContext.java:
>> 2680)
>>      at
>> usageoptreq
>> .UsageOptReqTest.testCompileAndTransform(UsageOptReqTest.java:34)
>>      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>      at
>> sun
>> .reflect 
>> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
>> 39)
>>      at
>> sun
>> .reflect
>> .DelegatingMethodAccessorImpl 
>> .invoke(DelegatingMethodAccessorImpl.java:
>> 25)
>>      at java.lang.reflect.Method.invoke(Method.java:324)
>>      at junit.framework.TestCase.runTest(TestCase.java:154)
>>      at junit.framework.TestCase.runBare(TestCase.java:127)
>>      at junit.framework.TestResult$1.protect(TestResult.java:106)
>>      at junit.framework.TestResult.runProtected(TestResult.java:124)
>>      at junit.framework.TestResult.run(TestResult.java:109)
>>      at junit.framework.TestCase.run(TestCase.java:118)
>>      at junit.framework.TestSuite.runTest(TestSuite.java:208)
>>      at junit.framework.TestSuite.run(TestSuite.java:203)
>>      at
>> org
>> .eclipse
>> .jdt
>> .internal
>> .junit 
>> .runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:
>> 128)
>>      at
>> org
>> .eclipse
>> .jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>      at
>> org
>> .eclipse
>> .jdt
>> .internal 
>> .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
>> 460)
>>      at
>> org
>> .eclipse
>> .jdt
>> .internal 
>> .junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:
>> 673)
>>      at
>> org
>> .eclipse
>> .jdt 
>> .internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:
>> 386)
>>      at
>> org
>> .eclipse
>> .jdt 
>> .internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:
>> 196)
>>
>> so far the only workaround we found is either not to use
>> nillable="true" or not to use optional="true". you can guess that  
>> this
>> is not what we wanted ;-)
>>
>> is there a chance to get a bugfix? doesn anyone know a better
>> workaround?
>>
>> br,
>> günther
>>
>>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> jibx-users mailing list
> jibx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jibx-users
>



-- 
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to