Binding in JiBX with mixed contents
From: Ajay Singh Tomar (ajaysingh.tomar3_at_de.bosch.com)
Date: 02/04/04
- Next message: Joel: "Character encodings"
- Previous message: steve: "Re: Java for really thick people?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 4 Feb 2004 16:01:09 +0100
Hello,
I need your help in writing binding definition in JiBX for input file with
mixed
contents. I have referred to some documentations but yet to get a clue on
how to do it. So, I thought of approaching here.
Here are the example files which I am working on. The attached Java file and
Binding Definition supports only simple contents which I want to modify to
support Mixed Contents as defined in Input file.
Input XML File with Mixed Contents
<?xml version="1.0"?>
<MSRSW>
<SHORT-NAME>medc</SHORT-NAME>
<CATEGORY>PaVaSt</CATEGORY>
<SW-SYSTEMS>
<SW-SYSTEM>
<LONG-NAME>EDC/ME(D) 17</LONG-NAME>
<SHORT-NAME>MEDC17</SHORT-NAME>
<SW-DATA-DICTIONARY-SPEC>
<SW-SYSTEMCONSTS>
<SW-SYSTEMCONST>
<SHORT-NAME>ACCD_PANALIN_CUR_X</SHORT-NAME>
<SW-VALUES-CODED>
<VF>0x19</VF>
</SW-VALUES-CODED>
</SW-SYSTEMCONST>
<SW-SYSTEMCONST>
<SHORT-NAME>ACC_RES</SHORT-NAME>
<SW-VALUES-CODED>
<VF>0.001</VF>
</SW-VALUES-CODED>
</SW-SYSTEMCONST>
<SW-SYSTEMCONST>
<SHORT-NAME>ACCD_SWTPRESSEL_TYPE</SHORT-NAME>
<SW-VALUES-CODED>
<VF> <SW-SYSTEMCONST-CODED-REF>SWT_TYPE_APPL</SW-SYSTEMCONST-CODED-REF>
</VF>
</SW-VALUES-CODED>
</SW-SYSTEMCONST>
<SW-SYSTEMCONST>
<SHORT-NAME>ACCD_SWTPRESSEL_VAL</SHORT-NAME>
<SW-VALUES-CODED>
<VF>
<SW-SYSTEMCONST-CODED-REF>ACCD_PRESSEL_PWM</SW-SYSTEMCONST-CODED-REF> </VF>
</SW-VALUES-CODED>
</SW-SYSTEMCONST>
<SW-SYSTEMCONST>
<SHORT-NAME>AIR_MASS_NORM</SHORT-NAME>
<SW-VALUES-CODED>
<VF>(( <SW-SYSTEMCONST-PHYS-REF>AMPC_RES</SW-SYSTEMCONST-PHYS-REF>/
<SW-SYSTEMCONST-PHYS-REF>AMPT_RES</SW-SYSTEMCONST-PHYS-REF>)*
<SW-SYSTEMCONST-CODED-REF>CYL_FAC_NORM</SW-SYSTEMCONST-CODED-REF>) </VF>
</SW-VALUES-CODED>
</SW-SYSTEMCONST>
<SW-SYSTEMCONST>
<SHORT-NAME>ASD_TIME_DT_RES_FL</SHORT-NAME>
<SW-VALUES-CODED>
<VF>(
<SW-SYSTEMCONST-PHYS-REF>TIME_DT_RES</SW-SYSTEMCONST-PHYS-REF>/1.0E6) </VF>
</SW-VALUES-CODED>
</SW-SYSTEMCONST>
</SW-SYSTEMCONSTS>
</SW-DATA-DICTIONARY-SPEC>
</SW-SYSTEM>
</SW-SYSTEMS>
</MSRSW>
Corresponding Java File for Simple Content
import java.util.ArrayList;
public class Msrsw
{
public String msrswCategory;
public String msrswShortName;
public String swSystemLongName;
public String swSystemShortName;
private ArrayList swSystemConstants;
}
class SwSystemConstant
{
public String swSystemConstantShortName;
public String swValuesCodedVF;
}
Binding Definition File for Simple Content
<binding>
<mapping name="MSRSW" class="Msrsw" >
<value name="SHORT-NAME" field="msrswShortName" />
<value name="CATEGORY" field="msrswCategory" />
<structure name="SW-SYSTEMS">
<structure name="SW-SYSTEM">
<value name="LONG-NAME" field="swSystemLongName" />
<value name="SHORT-NAME" field="swSystemShortName" />
<structure name="SW-DATA-DICTIONARY-SPEC">
<structure name="SW-SYSTEMCONSTS">
<collection field="swSystemConstants" item-type="SwSystemConstant" />
</structure>
</structure>
</structure>
</structure>
</mapping>
<mapping name="SW-SYSTEMCONST" class="SwSystemConstant" >
<value name="SHORT-NAME" field="swSystemConstantShortName" />
<structure name="SW-VALUES-CODED">
<value name="VF" field="swValuesCodedVF" />
</structure>
</mapping>
</binding>
Regards,
Ajay
- Next message: Joel: "Character encodings"
- Previous message: steve: "Re: Java for really thick people?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]