×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 23
  1. #1
    Registered User
    Join Date
    Jul 2012
    Location
    India
    Posts
    103

    How To Extract Text From Html Web page in j2me Midlet(java)

    Hi Everyone,

    The Input URL:

    http://www.teluguone.com/news/conten...-25-15676.html

    i want to extract the Description text from the below URL,I have tried different HTML Parsers like Jericho HTML Parser ,HTML Parser ,J soup Parser But those all are not supported in j2me
    and Tried Even Regular Expression also,But Still ,i am not able to extract the Description text from the URL

    Any help ....will be appreciated

    Thanks
    Pavan
    Emailavankumarragi@gmail.com

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: How To Extract Text From Html Web page in j2me Midlet(java)

    If you mean the movie description, the page structure looks like it won't be that easy to extract with simple searches (upon a quick glance, it looks like you need to find the paragraph within the div with class "innercontenttxt" within a div with the ID "innercontenttxt").

    I have no idea which J2ME parser/library would be useful for something like this.

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2012
    Location
    Surabaya, Indonesia
    Posts
    72

    Re: How To Extract Text From Html Web page in j2me Midlet(java)

    I suggest you to do data scraping using YQL.
    And then, you can call the query using public REST query from: http://query.yahooapis.com/v1/public/yql?q=
    Jeffrey Hermanto Halimsetiawan
    Game Developer | Mobile Apps Developer
    LinkedIn

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

    Re: How To Extract Text From Html Web page in j2me Midlet(java)

    Thanks for reply

    i am new to Mobile app as well as new to YQL,How can i Make a Call and get Response from YQL in J2me (Java)Application,i am

    not understanding

    Can you tell me the way to interact from my J2me App to YQL to Extract the Text From Html Web Page "http://www.teluguone.com/news/content/Psycho-Samba-Police-Decides-to-Stop-Search-Operations-25-15676.html"

    Any Sample Code pls...

    Regards
    Pavan
    Emailavankumarragi@gmail.com




    Quote Originally Posted by jeffrey.halimsetiawan View Post
    I suggest you to do data scraping using YQL.
    And then, you can call the query using public REST query from: http://query.yahooapis.com/v1/public/yql?q=
    Last edited by pavanragi; 2012-07-21 at 18:15.

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2012
    Location
    Surabaya, Indonesia
    Posts
    72

    Re: How To Extract Text From Html Web page in j2me Midlet(java)

    You can use this query to get all of the body section of your page:
    SELECT * FROM html WHERE url="http://www.teluguone.com/news/content/Psycho-Samba-Police-Decides-to-Stop-Search-Operations-25-15676.html"
    The result of this query can be called from this REST link.
    If you just want to get some parts of that link, you can use XPath. For example:
    SELECT * FROM html WHERE url="http://www.teluguone.com/news/content/Psycho-Samba-Police-Decides-to-Stop-Search-Operations-25-15676.html" AND xpath="//div[@id='headermain']"
    Then, you can get the data from J2ME using HttpConnection class with GET request.
    You will get a XML file, so you need to parse the file sing kXML Parser.

    I hope my explanation can help you.
    Jeffrey Hermanto Halimsetiawan
    Game Developer | Mobile Apps Developer
    LinkedIn

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

    How to do Parsing in j2me

    Hii All

    i want to extract the <iframe tag "src" value from the below url

    http://www.teluguone.com/videos/sing...nes-14727.html

    <iframe width="640" height="380" src="http://www.youtube.com/embed/XJDw2T1nGJQ" frameborder="0" allowfullscreen></iframe>

    How can i achieve it in j2me(java)?htmlparser ,Jericho ,Jsoup parser are not supported in j2me

  7. #7
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

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

    Re: How to do Parsing in j2me

    First i need to read the url http://www.teluguone.com/videos/sing...nes-14727.html and after that ,i shoul use j2me regexp

    can you tell me ,How can i proceed to apply reg Ex?

    How to Convert this url to text in j2me?
    Any Sample code




    Last edited by pavanragi; 2012-07-24 at 09:31.

  9. #9
    Nokia Developer Expert
    Join Date
    May 2012
    Location
    Espoo
    Posts
    224

    Re: How to do Parsing in j2me

    Hi pavanragi,

    LWUIT might help you. Look com.sun.lwuit.html.HTMLElement; And com.sun.lwuit.html.HTMLComponent; classes at LWUIT doc

    Check lwuit example application LWUITbrowser
    See specially BrowserForm.java/search() method

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

    Re: How to do Parsing in j2me

    Hii bandarap

    Thank you so much..............


    Quote Originally Posted by bandarap View Post
    Hi pavanragi,

    LWUIT might help you. Look com.sun.lwuit.html.HTMLElement; And com.sun.lwuit.html.HTMLComponent; classes at LWUIT doc

    Check lwuit example application LWUITbrowser
    See specially BrowserForm.java/search() method

  11. #11
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: How to do Parsing in j2me

    If you go the regular expression way...
    Code:
    /(<iframe)(.*?)(<\/iframe>)/ig
    ...will match "iframe" tag content (more or less), and...
    Code:
    /(src=")(.*?)(")/i
    ...will match the "src" attribute value within the result of the previous match.

    Even if it is for the Perl programming language and not Java, a good, relatively compact regular expressions tutorial can be found here:

    http://perldoc.perl.org/perlretut.html

    A good book on the subject is "Mastering Regular Expressions":

    http://shop.oreilly.com/product/9780596528126.do

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

    Re: How to do Parsing in j2me

    Thanks Petrib......



    Quote Originally Posted by petrib View Post
    If you go the regular expression way...
    Code:
    /(<iframe)(.*?)(<\/iframe>)/ig
    ...will match "iframe" tag content (more or less), and...
    Code:
    /(src=")(.*?)(")/i
    ...will match the "src" attribute value within the result of the previous match.

    Even if it is for the Perl programming language and not Java, a good, relatively compact regular expressions tutorial can be found here:

    http://perldoc.perl.org/perlretut.html

    A good book on the subject is "Mastering Regular Expressions":

    http://shop.oreilly.com/product/9780596528126.do

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

    i want to extract text between div tag in j2me(java)

    Hiiii

    i want to extract text between div tag in j2me

    <div class="innercontenttxt">
    <p>img border="1" align="left" height="170" width="324" vspace="3" hspace="2" src="/tmdbuserfiles/ramdev-balakrishna(1).jpg" alt="ramdev aide remanded, lakrishna acharya judicial remand, ramdev aide fake passport case, baba ramdev assistant judicial custody, balakrishna sent to judicial custody, yoga guru ramdev assistant remanded, yoga guru ramdev assistant balakrishna" />
    Yoga guru Ramdev's aide Balakrishna Acharya remanded to 14 days judicial custody in a fake passport on Saturday. He was arrested yesterday after he failed to appear at a Dehradun court.
    <br />
    <br />
    Balakrishna Acharya, who is basically a Nepalese citizen,
    is alleged to have submitted fake documents to procure a passport.
    When he failed to appear in Dehradun court in connection with the case,
    </p>
    </div>

    After extracting the result should be:
    ramdev aide alakrishna Acharya remanded to 14 days judicial custody in a fake passport on Saturday. He was arrested yesterday after he failed to appear at a Dehradun court.Balakrishna Acharya, who is basically a Nepalese citizen, is alleged to have submitted fake documents to procure a passport. When he failed to appear in Dehradun court in connection with the case, the court had issued a non-bailable warrant and subsequently arrested him yesterday.

    I have tried Jericho HTML Parser ,HTML Parser ,J soup Parser But the java.net.url class is not available in j2me

    Help me.....

  14. #14
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: i want to extract text between div tag in j2me(java)

    Modify the first regular expression I already gave you in http://www.developer.nokia.com/Commu...l=1#post900261

    (Moderators might just as well merge this thread with that one.)

  15. #15
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,745

    Re: i want to extract text between div tag in j2me(java)

    Indeed, this thread consists of 3 of yours by now ("How To Extract Text From Html Web page in j2me Midlet(java)", "How to do Parsing in j2me" and this "new" one, "i want to extract text between div tag in j2me(java)").
    However sooner or later repeated questions will be just deleted without merging/answering again.

Similar Threads

  1. Replies: 3
    Last Post: 2008-08-01, 07:26
  2. How to show J2ME MIDP games on html page ?
    By sohan.soni in forum Mobile Java Games
    Replies: 9
    Last Post: 2006-05-20, 18:15
  3. How to show J2ME MIDP games on html page ?
    By sohan.soni in forum Mobile Java General
    Replies: 1
    Last Post: 2006-04-15, 23:06
  4. How to show J2ME MIDP games on html page ?
    By sohan.soni in forum Mobile Java General
    Replies: 5
    Last Post: 2006-04-04, 14:08
  5. Generating a HTML page from the J2ME application
    By ashishga in forum Mobile Java Networking & Messaging & Security
    Replies: 0
    Last Post: 2006-01-20, 11:21

Posting Permissions

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