Can we see your binding file?
-----Original Message-----
From: Michael Handler [mailto:[email protected]]
Sent: 14 April 2010 12:11
To: [email protected]
Subject: [jibx-users] problem with boolean in choice
Hi,
I have a problem with jibx (starting from an xml schema) using a boolean
element in a choice element. Somehow the resulting xml does not contain
the boolean value if the boolean is set to false, although it works fine
if the boolean is set to true. The resulting xml cannot be parsed
correctly (no choice is selected)...
I use the maven jibx plugin (verison 1.2.2) to create the java files and
the binding from a xml schema.
Here is the relevant part of the schema file:
<xs:element name="XMLPrimitive1">
<xs:complexType>
<xs:choice>
<xs:element name="boolean" type="xs:boolean" />
<xs:element name="string" type="xs:string" />
</xs:choice>
</xs:complexType>
</xs:element>
Using the following code to create the xml:
XMLPrimitive1 xmlPrimitive = new XMLPrimitive1();
xmlPrimitive.setBoolean(false);
JibxXmlSerializer serializer = new JibxXmlSerializer();
StringWriter writer = new StringWriter();
serializer.serialize(xmlPrimitive, writer);
String xml = writer.toString();
System.out.println(xml);
The output is:
<?xml version="1.0" encoding="UTF-8"?><XMLPrimitive1/>
Shouldn't this rather be:
<?xml version="1.0"
encoding="UTF-8"?><XMLPrimitive1><boolean>false</boolean></XMLPrimitive1
>
as the xml looks like this when the boolean value is set to true:
<?xml version="1.0"
encoding="UTF-8"?><XMLPrimitive1><boolean>true</boolean></XMLPrimitive1>
Thank you for your help!
kind regards,
Michael Handler
------------------------------------------------------------------------
------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 9.0.801 / Virus Database: 271.1.1/2800 - Release Date: 04/13/10
21:22:00
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users