简体   繁体   中英

Difficulty using XMLView in codenameone

I am trying to use XMLView to display small html. This is the html

<?xml version="1.0" encoding="windows-1252"?>
<doc><body><p uiid="headline"> Election Result</b></p><p>Ward -- W1001<br>
</p><p>Votes For -- ABP,200<br> -- A,100<br></p><carousel>  <img src="http://res.cloudinary.com/okwui/image/upload/v1545561341/pukuxkn2pgmgbcplqgi8.png"/><br> 
<img src="http://res.cloudinary.com/okwui/image/upload/v1545561342/zkwfawmolbvta3lfd2ld.png"/><br></carousel><p>
Additional Notes -- <br></p><p>Election -- Presidential2019<br></p><p>Date of Election -- Sun Dec 23 11:35:14 WAT 2018<br></p><p>Booth -- B001<br></p>
<p>Constituency -- C001<br></p><p>State -- Abia<br></p> </body></doc

I keep getting this error

java.lang.NullPointerException
at com.codename1.xml.Element.iterator(Element.java:767)
at com.codename1.components.xmlview.ParagraphView.getText(ParagraphView.java:66)
at com.codename1.components.xmlview.ParagraphView.getText(ParagraphView.java:68)
at com.codename1.components.xmlview.ParagraphView.getText(ParagraphView.java:68)
at com.codename1.components.xmlview.ParagraphView.getText(ParagraphView.java:68)
at com.codename1.components.xmlview.ParagraphView.getText(ParagraphView.java:68)
at com.codename1.components.xmlview.ParagraphView.getText(ParagraphView.java:68)
at com.codename1.components.xmlview.ParagraphView.getText(ParagraphView.java:75)
at com.codename1.components.xmlview.ParagraphView.createView(ParagraphView.java:50)
at com.codename1.components.xmlview.XMLView.createView(XMLView.java:377)
at com.codename1.components.xmlview.XMLView.setXML(XMLView.java:356)
at com.codename1.components.xmlview.XMLView.setXML(XMLView.java:302)

Obviously there is something wrong with the XML file but I am unable to pinpoint. Pls help.

You need to follow the syntax mentioned in the XMLView project eg <br> isn't valid XML. I'm not sure if body is necessary or not:

See https://github.com/shannah/cn1-xmlview/blob/master/src/SampleNewsFeed.xml

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM