简体   繁体   English

在 codenameone 中使用 XMLView 的困难

[英]Difficulty using XMLView in codenameone

I am trying to use XMLView to display small html.我正在尝试使用 XMLView 来显示小 html。 This is the html这是 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.显然 XML 文件有问题,但我无法查明。 Pls help.请帮忙。

You need to follow the syntax mentioned in the XMLView project eg <br> isn't valid XML.您需要遵循XMLView 项目中提到的语法,例如<br>不是有效的 XML。 I'm not sure if body is necessary or not:我不确定是否需要 body :

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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