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:

  1. A
    formites class appears that all data in this class is mapped to XML properties, so that you can see the @XmlAttribute .
  2. Many of their formItems elements, 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 @XmlElementWrapper annotation and you will need the form class which is the list < FormItems> gt; / Code> property.
  3. You must @XmlRootElement .
will also require a class matching to your original element annotated. Model

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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -