java - Convert HTML (String attribute of class) to XML -


i have class

@xmlrootelement(name = "newsletter") public class newsletter {  /*************/ string content;  /*************/ @xmlelement public string getcontent() {     return content; }  public void setcontent(string content) {     this.content = content; }  /*******content value <p>     <p>         <img alt="" src="http://pngimg.com/upload/small/star_png1598.png" style="width: 280.0px;height: 277.0px;float: left;" />         orientis vero limes in longum protentus et rectum ab euphratis fluminis      </p>     <div class="texte" id="thetexte" lang="zxx">         <p>             haec dum oriens diu perferret         </p>     </div> </p>  ********/   } 

i want convert these html content xml elements , attributes.

i try

bytearrayoutputstream newsletterxml = new bytearrayoutputstream(); jaxbcontext jaxbcontext = null; jaxbcontext = jaxbcontext.newinstance(newsletter.class);  marshaller marshaller = jaxbcontext.createmarshaller(); marshaller.setproperty(marshaller.jaxb_formatted_output, true); marshaller.marshal(newsletter, newsletterxml); 

but xml output that

<?xml version="1.0" encoding="utf-8" standalone="yes"?> <newsletter>     <content>     &lt;p&gt;         &lt;img alt=&quot;&quot; src=&quot;http://pngimg.com/upload/small/star_png1598.png&quot; style=&quot;width: 280.0px;height: 277.0px;float: left;&quot; /&gt;orientis vero limes in longum protentus et rectum ab euphratis fluminis ripis ad usque supercilia porrigitur nili, laeva saracenis conterminans gentibus, dextra pelagi fragoribus patens, quam plagam nicator seleucus occupatam auxit magnum in modum, cum post alexandri macedonis obitum successorio iure teneret regna persidis, efficaciae inpetrabilis rex, ut indicat cognomentum.&lt;/p&gt;     &lt;div class=&quot;texte&quot; id=&quot;thetexte&quot; lang=&quot;zxx&quot;&gt;         &lt;p&gt;             haec dum oriens diu perferret, caeli reserato tepore constantius consulatu suo septies et caesaris ter egressus arelate valentiam petit, in gundomadum et vadomarium fratres alamannorum reges arma moturus, quorum crebris excursibus vastabantur confines limitibus terrae gallorum.&lt;/p&gt;         &lt;p&gt;             nec vox accusatoris ulla licet subditicii in malorum quaerebatur acervis ut saltem specie tenus crimina praescriptis legum committerentur, quod aliquotiens fecere principes saevi: sed quicquid caesaris implacabilitati sedisset, id velut fas iusque perpensum confestim urgebatur impleri.&lt;/p&gt;         &lt;p&gt;             nam sole orto magnitudine angusti gurgitis sed profundi transitu arcebantur et dum piscatorios quaerunt lenunculos vel innare temere contextis cratibus parant, effusae legiones, quae hiemabant tunc apud siden, isdem impetu occurrere veloci. et signis prope ripam locatis ad manus comminus conserendas denseta scutorum conpage semet scientissime praestruebant, ausos quoque aliquos fiducia nandi vel cavatis arborum truncis amnem permeare latenter facillime trucidarunt.&lt;/p&gt;         &lt;p&gt;             ut enim benefici liberalesque sumus, non ut exigamus gratiam (neque enim beneficium faeneramur sed natura propensi ad liberalitatem sumus), sic amicitiam non spe mercedis adducti sed quod omnis eius fructus in ipso amore inest, expetendam putamus.&lt;/p&gt;     &lt;/div&gt;     &lt;p&gt;     &amp;nbsp;&lt;/p&gt; </content> <newsletter> 

how can parse html string xml, using jaxb if possible, if not, solution.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -