2

I'm getting HtmlString From Rss File after parsing.I want to remove all html tags and need to display only the pure text on my Form,For that I've referred LWUIT HtmlComponent Class and I used below code:

    private void displayCompleteNewsScreen(News detailNews) {
        html.removeAll();
        form2.removeAll();
        form2.repaint();
        form2.addCommand(m_backCommand);
        form2.addCommandListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                form1.show();
            }
        });
    String content= detailNews.getDescription();
    html.setPreferredSize(new Dimension(300,300));
    html.setHTML(content, null, null, false);
    form2.addComponent(html);
    form2.show();
}

I'm able to display the text successfully on my LWUITform ,but I'm throwing the below Exceptions Every time when i display my Text on Form

Exception1:

Uncaught exception: java.util.NoSuchElementException
    at java.util.Vector.lastElement(Vector.java:456)
 - com.sun.lwuit.html.HTMLComponent.popContainer(HTMLComponent.java:3667)
 - com.sun.lwuit.html.HTMLComponent.processTag(HTMLComponent.java:2825)
 - com.sun.lwuit.html.HTMLComponent.rebuildPage(HTMLComponent.java:1653)
 - com.sun.lwuit.html.HTMLComponent.documentReady(HTMLComponent.java:1113)
 - com.sun.lwuit.html.HTMLComponent$1.run(HTMLComponent.java:770)

Exception2:

Uncaught exception: 
  java.lang.OutOfMemoryError
   (stack trace incomplete)
java.lang.OutOfMemoryError
   (stack trace incomplete)

Exception3:

Uncaught exception: java.lang.IllegalArgumentException: Component is already contained in Container: Container[x=0 y=0 width=0 height=0, layout = BoxLayout, scrollableX = false, scrollableY = false, components = [Container]]
 - com.sun.lwuit.Container.insertComponentAt(Container.java:370)
 - com.sun.lwuit.Container.addComponent(Container.java:334)
 - com.sun.lwuit.html.HTMLComponent.newLine(HTMLComponent.java:1878)
 - com.sun.lwuit.html.HTMLComponent.processTag(HTMLComponent.java:2826)
 - com.sun.lwuit.html.HTMLComponent.rebuildPage(HTMLComponent.java:1653)
 - com.sun.lwuit.html.HTMLComponent.documentReady(HTMLComponent.java:1113)

Note:My HtmlString will not Contain any Image and src Tags

can any one help me...

String
  • 3,660
  • 10
  • 43
  • 66

1 Answers1

0

There seems to be a parse error in the HTML code. Is it a full set of HTML containing the actual HTML tag, body etc.?

Shai Almog
  • 51,749
  • 5
  • 35
  • 65