HTML parser

Discussion in 'Java' started by ABAKUS, Jun 3, 2004.

  1. ABAKUS

    ABAKUS Guest

    Hi, Can you help me?
    I try to write html parser, but nothing unacts me unknow that make wrong. I
    have found something code, but I don't know what insert before this code :
    if (t == HTML.Tag.META)
    {
    System.out.println("Inside META tage data");

    String attrib = (String) a.getAttribute (HTML.Attribute.NAME);
    if (attrib != null)
    {
    }
    String content =(String) a.getAttribute(HTML.Attribute.CONTENT);
    if (content != null)
    {

    }
    String httpequiv = (String)a.getAttribute(HTML.Attribute.HTTPEQUIV);
    if (httpequiv != null)
    {

    }
    String meta = attrib + content + httpequiv;
    System.out.println(meta);
    }
    ABAKUS, Jun 3, 2004
    #1
    1. Advertising

  2. ABAKUS

    JavaJug Guest

    ABAKUS wrote:

    > Hi, Can you help me?
    > I try to write html parser, but nothing unacts me unknow that make wrong. I
    > have found something code, but I don't know what insert before this code :
    > if (t == HTML.Tag.META)
    > {
    > System.out.println("Inside META tage data");
    >
    > String attrib = (String) a.getAttribute (HTML.Attribute.NAME);
    > if (attrib != null)
    > {
    > }
    > String content =(String) a.getAttribute(HTML.Attribute.CONTENT);
    > if (content != null)
    > {
    >
    > }
    > String httpequiv = (String)a.getAttribute(HTML.Attribute.HTTPEQUIV);
    > if (httpequiv != null)
    > {
    >
    > }
    > String meta = attrib + content + httpequiv;
    > System.out.println(meta);
    > }
    >


    You can parse html with the Swing classes of Java.
    See http://www.informit.com/articles/article.asp?p=31059&redir=1

    --
    "There is a theory which states that if ever anyone discovers exactly what the
    Universe is for and why it is here, it will instantly disappear and be replaced
    by something even more bizarre and inexplicable.
    There is another theory which states that this has already happened."
    -- Douglas Adams
    JavaJug, Jun 3, 2004
    #2
    1. Advertising

  3. Hello!
    You want to write parser or parse HTML file?
    If last than use http://xmlc.objectweb.org/

    ABAKUS wrote:
    > Hi, Can you help me?
    > I try to write html parser, but nothing unacts me unknow that make wrong. I
    > have found something code, but I don't know what insert before this code :
    > if (t == HTML.Tag.META)
    > {
    > System.out.println("Inside META tage data");
    >
    > String attrib = (String) a.getAttribute (HTML.Attribute.NAME);
    > if (attrib != null)
    > {
    > }
    > String content =(String) a.getAttribute(HTML.Attribute.CONTENT);
    > if (content != null)
    > {
    >
    > }
    > String httpequiv = (String)a.getAttribute(HTML.Attribute.HTTPEQUIV);
    > if (httpequiv != null)
    > {
    >
    > }
    > String meta = attrib + content + httpequiv;
    > System.out.println(meta);
    > }
    >
    >
    >
    >
    >
    Pavel L.Yatsuk, Jun 4, 2004
    #3
  4. ABAKUS

    Roedy Green Guest

    On Thu, 3 Jun 2004 09:48:53 +0200, "ABAKUS" <>
    wrote or quoted :

    > I try to write html parser, but nothing unacts me unknow that make wrong.


    see http://mindprod.com/jgloss/parser.html


    Quiotix will turn HTML into a tree you can then chase.
    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
    Roedy Green, Jun 4, 2004
    #4
  5. On Fri, 04 Jun 2004 13:32:33 +0300, Pavel L.Yatsuk <>
    wrote:

    > Hello!
    > You want to write parser or parse HTML file?
    > If last than use http://xmlc.objectweb.org/
    >
    > ABAKUS wrote:
    >> Hi, Can you help me?
    >> I try to write html parser, but nothing unacts me unknow that make
    >> wrong. I


    The JTidy toolkit - http://sourceforge.net/projects/jtidy
    is another possible source of inspiration for parsing HTML.
    Bill


    ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
    ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
    William Brogden, Jun 5, 2004
    #5
  6. ABAKUS

    Rogan Dawes Guest

    ABAKUS wrote:

    > Hi, Can you help me?
    > I try to write html parser, but nothing unacts me unknow that make wrong. I
    > have found something code, but I don't know what insert before this code :


    Also have a look at HTMLParser on SourceForge.net

    http://sourceforge.net/projects/htmlparser/

    Rogan
    --
    Rogan Dawes

    *ALL* messages to will be dropped, and added
    to my blacklist. Please respond to "nntp AT dawes DOT za DOT net"
    Rogan Dawes, Jun 7, 2004
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mitchua
    Replies:
    1
    Views:
    7,042
    Ice Demon
    Jul 15, 2003
  2. ZOCOR

    XML Parser VS HTML Parser

    ZOCOR, Oct 3, 2004, in forum: Java
    Replies:
    11
    Views:
    799
    Paul King
    Oct 5, 2004
  3. David Virgil Hobbs
    Replies:
    2
    Views:
    17,239
  4. Bengt Richter
    Replies:
    0
    Views:
    516
    Bengt Richter
    Aug 3, 2003
  5. Zach Dennis

    HTML-Parser / SGML-Parser

    Zach Dennis, Oct 1, 2003, in forum: Ruby
    Replies:
    5
    Views:
    385
    Bernard Delmée
    Oct 1, 2003
Loading...

Share This Page