Hi, It is generated together with the Java Classes. But here is the interesting part of it:
<mapping class="org.openengsb.core.xmlmapping.XMLPrimitive1" name="XMLPrimitive1"> <structure ordered="false" choice="true"> <value style="element" name="boolean" test-method="ifBoolean" get-method="isBoolean" set-method="setBoolean" usage="optional"/> <value style="element" name="string" test-method="ifString" get-method="getString" set-method="setString" usage="optional"/> </structure> </mapping> The generated java code looks like this: public class XMLPrimitive1 { private int XMLPrimitive1Select = -1; private static final int BOOLEAN_CHOICE = 0; private static final int STRING_CHOICE = 1; private boolean _boolean; private String string; private void setXMLPrimitive1Select(int choice) { if (XMLPrimitive1Select == -1) { XMLPrimitive1Select = choice; } else if (XMLPrimitive1Select != choice) { throw new IllegalStateException( "Need to call clearXMLPrimitive1Select() before changing existing choice"); } } public void clearXMLPrimitive1Select() { XMLPrimitive1Select = -1; } public boolean ifBoolean() { return XMLPrimitive1Select == BOOLEAN_CHOICE; } public boolean isBoolean() { return _boolean; } public void setBoolean(boolean _boolean) { setXMLPrimitive1Select(BOOLEAN_CHOICE); this._boolean = _boolean; } public boolean ifString() { return XMLPrimitive1Select == STRING_CHOICE; } public String getString() { return string; } public void setString(String string) { setXMLPrimitive1Select(STRING_CHOICE); this.string = string; } } I just found out that the same problem occurs for integer (with 0 as value). Seems like there is a problem when primitives are set to their default values. kind regards, Michael Handler Am 14.04.2010 13:55, schrieb Ben Davies: > Can we see your binding file? > > -----Original Message----- > From: Michael Handler [mailto:michael.hand...@fullstop.at] > Sent: 14 April 2010 12:11 > To: jibx-users@lists.sourceforge.net > 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 > jibx-users@lists.sourceforge.net > 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 > jibx-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/jibx-users > > > ------------------------------------------------------------------------------ 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 jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users