java - How to build a JAXB model to match my XML? -
I need to process this XML with JAXB, but I'm not sure how to match an object model .
& lt; UI5SOLTGET & gt; & Lt; Form Formand = "U5_SolTar" FrmTit = "Solution" & lt; FormItems FrmIte = "1" FrmLab = "Numero de Serie" FrmVal = "" FrmData = "SER" FrmType = "T3" FrmRest = "" FrmEna = "true" /> & Lt; FormItems FrmIte = "2" FrmLab = "Normal D Voucher" FrmVal = "" FrmData = "VOU" FrmType = "N9" FrmRest = "" FrmEna = "true" /> & Lt; FormItems FrmIte = "3" FrmLab = "Fecha Vencimiento" FrmVal = "" FmData = "FECP" FMT Type = "F" FRMRIST = "!" FrmEna = "true" /> & lt; FormItems FrmIte = "4" FrmLab = "Es XNET" FrmVal = "" FrmData = "XNET" FrmType = "B" FrmRest = "" FrmEna = "True" /> & Lt; FormItems FrmIte = "5" FrmLab = "Nimero de Trejeta" framivil = "" FrmData = "TAR" FrmType = "T20" FrmRest = "" FrmEna = "true" /> & Lt; FormItems FrmIte = "6" FrmLab = "Plan de la Stragata" FrmVal = "" FrmData = "PLAN" FRMType = "N3" FRMRest = "" FRMEna = "true" /> & Lt; FormItems FrmIte = "7" FrmLab = "Nemero de Carterea" FRMVil = "" FRMDITA = "CR" FRMTEP = "N3" FRMRST = "" FRMEna = "True" /> & Lt; FormItems FrmIte = "8" FrmLab = "Numero d'Autorzesian" FRMVil = "" FRMDIT = "DT1" FMTIP = "T12" FRMRIST = "FMEN =" True "/> & Lt; FormItems FrmIte = "9" FrmLab = "Nemero de Lite" FrmVal = "" FrmData = "DT2" FrmType = "T12" FrmRest = "" FrmEna = "true" /> & Lt; FormItems FrmIte = "10" FrmLab = "Numero Ticket" FrmVal = "" FrmData = "DT3" FrmType = "T12" FrmRest = "" FrmEna = "true" /> & Lt; FormItems FrmIte = "11" FrmLab = "Visa Itou [C] red / [D] EB." FrmVal = "" FrmData = "CRDB" FRMTEP = "T1" FRMRIST = "CDD" FRMENA = "True" /> & Lt; / Form & gt; & Lt; / UI5SOLTGET & gt;
Java model
In case of your use, The requirement will be:
- A
- Many of their
formItemselements, so they will be referred to as a collection. The original element includes mapped data so that you will not be able to take advantage of the@XmlElementWrapperannotation and you will need theformclass which is thelist < FormItems> gt; / Code> property..- You must
@XmlRootElement - You must
Once you need to adjust your metadata to your Java model, make sure that it matches XML which you want to read / write, the easiest way to do this is to Populate the object model and martial it and keep in mind why it is different from your targeted XML. JAXB does not require any annotation so that you can start it right away.
Since all your XML elements and attributes begin with capital letters, you need to find out that you have name @XmlRootElement , @XmlElement < / Code>, and code on all uses of @xmlAttribute property
Comments
Post a Comment