Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6874787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:14:17+00:00 2026-05-27T04:14:17+00:00

I want to get data in my BlackBerry app from an xml file. I

  • 0

I want to get data in my BlackBerry app from an xml file. I reseach and see that using kxml2 is the best choice.
But I can not find example code for it on Blackberry. I open kxml2.jar, I see xmlParser and kxmlParser, which one should I use?

Can anbody help me expalin how to use kxml2 clearly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:14:17+00:00Added an answer on May 27, 2026 at 4:14 am

    A normal XML parsing and displaying in listfield sample is here.. don’t go for too complex this at basic..

    public class xmlparsing extends UiApplication implements ListFieldCallback, FieldChangeListener 
    {
    
    public static void main(String[] args)
    {
    xmlparsing app = new xmlparsing();
    app.enterEventDispatcher();
    }
    
    
    public long mycolor ;
    Connection _connectionthread; 
    private static ListField _list;
    private static Vector listElements = new Vector();
    public MainScreen screen = new MainScreen();
    VerticalFieldManager mainManager;
    VerticalFieldManager subManager;
    
    
    
    public xmlparsing() 
    { 
    super();
    pushScreen(screen);
    
    final Bitmap backgroundBitmap = Bitmap.getBitmapResource("blackbackground.png");
    
    mainManager = new VerticalFieldManager(Manager.NO_VERTICAL_SCROLL |     Manager.NO_VERTICAL_SCROLLBAR )
    {
    
    public void paint(Graphics graphics)
    {
    graphics.drawBitmap(0, 0, Display.getWidth(),Display.getHeight(),backgroundBitmap, 0, 0);
    
    super.paint(graphics);
    }
    
    };
    
    subManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR     )
    {
    protected void sublayout( int maxWidth, int maxHeight )
    {
    int displayWidth = Display.getWidth();
    int displayHeight = Display.getHeight();
    
    super.sublayout( displayWidth, displayHeight);
    setExtent( displayWidth, displayHeight);
    }
    }; 
    
    
    screen.add(mainManager);
    
    _list = new ListField()
    
    {
    
    public void paint(Graphics graphics)
    
    {
    graphics.setColor((int) mycolor);
    super.paint(graphics);
    
    }
    
    };
    mycolor = 0x00FFFFFF;
    _list.invalidate();
    _list.setEmptyString("* Feeds Not Available *", DrawStyle.HCENTER);
    _list.setRowHeight(50);
    _list.setCallback(this);
    mainManager.add(subManager); 
    listElements.removeAllElements();
    _connectionthread = new Connection(); 
    _connectionthread.start();
    }
    
    
    protected boolean navigationClick(int status, int time)
    {
    try
    {
    //navigate here to another screen if you need. 
    }
    catch(Exception e)
    {
    System.out.println("Exception:- : navigationClick() "+e.toString());
    }
    return true;
    }
    
    
    
    private class Connection extends Thread
    { 
    public Connection()
    { 
    super(); 
    } 
    
    public void run() { 
    Document doc; 
    StreamConnection conn = null; 
    InputStream is = null; 
    try { 
    
    conn = (StreamConnection)     Connector.open("http://timesofindia.feedsportal.com/c/33039/f/533917/index.rss"+";deviceside=true");
    
    DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); 
    docBuilderFactory.setIgnoringElementContentWhitespace(true);
    docBuilderFactory.setCoalescing(true);
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder(); 
    docBuilder.isValidating(); 
    is = conn.openInputStream(); 
    doc = docBuilder.parse(is); 
    doc.getDocumentElement().normalize(); 
    NodeList list = doc.getElementsByTagName("title"); 
    for (int i = 0; i < list.getLength(); i++) { 
    Node textNode = list.item(i).getFirstChild(); 
    listElements.addElement(textNode.getNodeValue());
    } 
    
    } catch (Exception e) { 
    System.out.println(e.toString()); 
    } finally { 
    if (is != null) { 
    try { is.close(); 
    } catch (IOException ignored) {} 
    } if (conn != null) { 
    try { conn.close(); } 
    catch (IOException ignored) {} 
    } } UiApplication.getUiApplication().invokeLater(new Runnable() {
    public void run() { 
    _list.setSize(listElements.size()); 
    subManager.add(_list);
    screen.invalidate();
    } 
    });
    }
    
    }
    
    
    public void drawListRow(ListField list, Graphics g, int index, int y, int w) 
    { 
    String tes = (String)listElements.elementAt(index);
    int yPos = 0+y;
    g.drawLine(0, yPos, w, yPos);
    g.drawText(tes, 5, 15+y, 0, w);
    }
    
    
    public Object get(ListField list, int index) 
    {
    return listElements.elementAt(index); 
    } 
    public int indexOfList(ListField list, String prefix, int string)
    { 
    return listElements.indexOf(prefix, string); 
    } 
    public int getPreferredWidth(ListField list) 
    { 
    return Display.getWidth(); 
    } 
    public void insert(String toInsert, int index) {
    listElements.addElement(toInsert);
    }
    
    public void fieldChanged(Field field, int context) {
    
    
    }
    }
    

    Full Project is here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to get data from xml file and display it into html. Which
I'm getting an xml file and want to get data from it. The source
Whenever I want to get data from a plist file I use the following
I want to get data from a text file to a listview. A sample
i want to get data from xml parser ? how can i get from
I want to get data from an API using Python. The API documentation give
I want get data from one of my models. I am using Entity datamodel
I want to get data from webservice using NSXml Parser. I am able to
I want to get data from ADXL345 accelerometer,but seems that I incorrectly connect it.
I have heard that in web-based applications, when we want to get data from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.