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&#174; 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
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to