Results 1 to 2 of 2
  1. #1
    Ada
    Ada is offline Member
    Join Date
    May 2007
    Posts
    8
    Rep Power
    0

    Question How to parse HTML tags

    How can i parse HTML tags? For example:

    Java Code:
    <H1>xxx</H2>
    <font size=3>xxxx</font>
    How can I get the xxx from the above HTML tags?

  2. #2
    levent Guest

    Default

    You can use following code segment:

    Java Code:
        String[] html = {"<H1>xxx</H2>","<font size=3>xxxx</font>"};
        System.out.println(html[0].replaceAll("\\<.*?\\>",""));
        System.out.println(html[1].replaceAll("\\<.*?\\>",""));
    But if you need more advanced functionality, you can consider using a HTML parsing library instead:

    HTML Parser - HTML Parser
    Jericho HTML Parser

Similar Threads

  1. Html tags within XML- need help
    By iamhappy in forum XML
    Replies: 2
    Last Post: 03-27-2008, 04:21 PM
  2. HTML tags for Struts
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-27-2007, 09:58 AM
  3. How to parse in html
    By paty in forum New To Java
    Replies: 1
    Last Post: 07-24-2007, 12:29 AM

Posting Permissions

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