×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2012
    Location
    India
    Posts
    103

    Facing issue when parsing html String in j2me

    Hi
    I've a String from html web page like this:

    String htmlString =
    HTML Code:
    <span style="mso-bidi-font-family:Gautami;mso-bidi-theme-font:minor-bidi">President Pranab pay great 
    tributes to Motilal Nehru on occasion of 
    </span>
    150th birth anniversary. Pranab said institutions evolved by 
    leaders like him should be strengthened instead of being destroyed. 
    <span style="mso-spacerun:yes">&nbsp;
    </span>
    He listed his achievements like his role in evolving of Public Accounts Committee and protecting independence of 
    Legislature from the influence of the Executive by establishing a separate cadre for the Central Legislative Assembly,   
    the first set of coins and postal stamps released at the function to commemorate the event.
    </p>

    i need to extract the text from above String ,after extraction my out put should look like
    OutPut:

    President Pranab pay great tributes to Motilal Nehru on occasion of 150th birth anniversary. Pranab said institutions evolved by leaders like him should be strengthened instead of being destroyed. He listed his achievements like his role in evolving of Public Accounts Committee and protecting independence of Legislature from the influence of the Executive by establishing a separate cadre for the Central Legislative Assembly, now Parliament. Calling himself a student of history, he said Motilal's Swaraj Party acted as a disciplined assault force in the Legislative Assembly and he was credited with evolving the system of a Public Accounts Committee which is now one of the most effective watchdogs over executive in matters of money and finance. Mukherjee also received the first set of coins and postal stamps released at the function to commemorate the event.

    For this i have used below logic:

    int spanIndex = content.indexOf("<span");
    spanIndex = content.indexOf(">", spanIndex);
    int endspanndex = content.indexOf("</span>", spanIndex);
    content = content.substring(spanIndex + 1, endspanndex);
    and my Resultant out put is:

    President Pranab pay great tributes to Motilal Nehru on occasion of
    I have used Different HTMLParsers,but those are not working in case of j2me

    can any one help me to get full description text? thanks .....

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,697

    Re: Facing issue when parsing html String in j2me

    This approach delivers the content of a single span tag, and if you check your input, the first tag really contains this half sentence only.
    What is wrong with the approach in your other thread (http://www.developer.nokia.com/Commu...e-Midlet(java))? That sould remove all kind of tags and leave the content concatenated in a single string.

  3. #3
    Registered User
    Join Date
    Jul 2012
    Location
    India
    Posts
    103

    Re: Facing issue when parsing html String in j2me

    Hi Wizrad,
    Thanks for your reply, i have followed my previous thread and i got solved my Issue..


    Quote Originally Posted by wizard_hu_ View Post
    This approach delivers the content of a single span tag, and if you check your input, the first tag really contains this half sentence only.
    What is wrong with the approach in your other thread (http://www.developer.nokia.com/Commu...e-Midlet(java))? That sould remove all kind of tags and leave the content concatenated in a single string.

Similar Threads

  1. Html Parsing in j2me
    By pavanragi in forum Mobile Java General
    Replies: 1
    Last Post: 2012-10-04, 09:00
  2. HTML string Displaying in HTML
    By rana.anees in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2012-03-13, 21:41
  3. HTML parsing
    By chia_84 in forum Mobile Java General
    Replies: 2
    Last Post: 2008-07-16, 09:11
  4. String parsing / String Tokenizer
    By khurshed79 in forum Symbian
    Replies: 0
    Last Post: 2005-08-08, 13:30
  5. XSL parsing of xml into wml and html
    By Nokia_Archive in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-05-14, 17:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×