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

  • Home
  • SEARCH
  • 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 7684427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:01:10+00:00 2026-05-31T19:01:10+00:00

I am developing a BlackBerry app which needs to read from an xml file.

  • 0

I am developing a BlackBerry app which needs to read from an xml file. I am able to read it but I would like to remove the tags such as <?xml version='1.0' encoding='UTF-8'?>, <feed>, <author> and so on…

I’m using a BlackBerry 9800 Simulator.

Have checked that my file is an Atom 1.0 file. So how should I remove these tags?

Currently my codes are as of this from what I got from the internet. But it only displays the ‘id’ and ‘updated’ date of the file. How can I display/filter certain data away and remove tags?

Thanks,
Hend

 class MyApp extends UiApplication{
//creating a member variable for the MainScreen
MainScreen _screen= new MainScreen();
//string variables to store the values of the XML document
String _node,_element;
Connection _connectionthread;

public static void main(String arg[]){
    MyApp application = new MyApp();
    //create a new instance of the application
    //and start the application on the event thread
    application.enterEventDispatcher();
}

public MyApp() {
    _screen.setTitle("XML Parsing");//setting title
    _screen.add(new RichTextField("Requesting....."));
    _screen.add(new SeparatorField());
    pushScreen(_screen); // creating a screen
    //creating a connection thread to run in the background
    _connectionthread = new Connection();
    _connectionthread.start();//starting the thread operation
}

public void updateField(String node, String element) 
{    
    synchronized (UiApplication.getEventLock()) 
    {
        String title = "My App";
        _screen.add(new RichTextField(node + " : " + element));
        if (node.equals(title))
        {
            _screen.add(new SeparatorField());
            }
        }
    } 


private class Connection extends Thread{
    public Connection(){
        super();
    }

    public void run(){
        // define variables later used for parsing

        Document doc;
        StreamConnection conn;

        try{
            //providing the location of the XML file,
            //your address might be different
            conn=(StreamConnection)Connector.open
              ("http://www.google.com");
            //next few lines creates variables to open a
            //stream, parse it, collect XML data and
            //extract the data which is required.
            //In this case they are elements,
            //node and the values of an element
            DocumentBuilderFactory docBuilderFactory
              = DocumentBuilderFactory. newInstance(); 
            DocumentBuilder docBuilder
              = docBuilderFactory.newDocumentBuilder();

            docBuilder.isValidating();
            doc = docBuilder.parse(conn.openInputStream());
            doc.getDocumentElement ().normalize ();
            NodeList list=doc.getElementsByTagName("*");
            _node=new String();
            _element = new String();
            //this "for" loop is used to parse through the
            //XML document and extract all elements and their
            //value, so they can be displayed on the device

            for (int i=0;i<list.getLength();i++){
                Node value=list.item(i).
                  getChildNodes().item(0);
                _node=list.item(i).getNodeName();
                _element=value.getNodeValue();
                updateField(_node,_element);
            }//end for
        }//end try
        //will catch any exception thrown by the XML parser
        catch (Exception e){
            System.out.println(e.toString());

        }
      }//end connection function
  }// end connection class
}//end XML_Parsing_Sample
  • 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-31T19:01:12+00:00Added an answer on May 31, 2026 at 7:01 pm

    Create another method which does the same run() but searching for another tagName. This allows info for several tags to be read and displayed.

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

Sidebar

Related Questions

I am looking into developing a small app to run on a blackberry which
I would like to begin developing for the Blackberry platform and, specifically, the Bold
i am developing app in Blackberry which have GPS Functionality. so first i want
When developing a blackberry app originally, I didn't pay much attention to being able
I'm developing a BlackBerry app which uses an embedded browser to display html content.
I am developing a BlackBerry app in which users can purchase virtual goods (such
I am developing blackberry application using BlackBerry JDE 5.0.X , in which i am
I am developing a blackberry application and i wanted to access the websites from
I am developing a blackberry app and I am new to Blackberry. I am
I'm developing a BlackBerry app and using J2ME Polish to do the styling. So,

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.