Font Tag

Discussion in 'HTML' started by Jo, Mar 28, 2006.

  1. Jo

    Jo Guest

    Hello evryone...
    i jus need to know whether font tag in HTML does not require a </font>
    tag.
    Me parsing out text from web page source code. I have to remove the
    entire tag
    <font >
    Any text
    </font>

    So i will read from <font> till I encounter a </font>
    It works fine..But i recently saw that certain webpages dont have
    closing </font> tag for all <font>
    Is it not necessary to put a </font> tag??

    What do i do now?
    Kindly help..

    Cheers
    Annie(Jo)
     
    Jo, Mar 28, 2006
    #1
    1. Advertising

  2. Jo wrote:

    > Hello evryone...
    > i jus need to know whether font tag in HTML does not require a </font>
    > tag.
    > Me parsing out text from web page source code. I have to remove the
    > entire tag
    > <font >
    > Any text
    > </font>
    >
    > So i will read from <font> till I encounter a </font>
    > It works fine..But i recently saw that certain webpages dont have
    > closing </font> tag for all <font>
    > Is it not necessary to put a </font> tag??


    The end tag is mandatory. If it is missing, then the webpage is invalid.

    > What do i do now?


    If you have to deal with invalid document, then you will either have to
    implement some pretty complex heuristics to get a result that works similar
    to how webbrowsers deal with these pages.
    Or you first pipe the document through a tool like HTML Tidy
    (http://www.w3.org/People/Raggett/tidy/) before you process it yourself.

    --
    Benjamin Niemann
    Email: pink at odahoda dot de
    WWW: http://pink.odahoda.de/
     
    Benjamin Niemann, Mar 28, 2006
    #2
    1. Advertising

  3. Jo

    Ed Mullen Guest

    Jo wrote:
    > Hello evryone...
    > i jus need to know whether font tag in HTML does not require a </font>
    > tag.
    > Me parsing out text from web page source code. I have to remove the
    > entire tag
    > <font >
    > Any text
    > </font>
    >
    > So i will read from <font> till I encounter a </font>
    > It works fine..But i recently saw that certain webpages dont have
    > closing </font> tag for all <font>
    > Is it not necessary to put a </font> tag??


    Yes, the HTML spec says that a <font> tag must be closed. Those Web
    pages are incorrectly coded.
    >
    > What do i do now?


    I guess you'll have to double-check the code manually.

    --
    Ed Mullen
    http://edmullen.net
    http://mozilla.edmullen.net
    http://abington.edmullen.net
     
    Ed Mullen, Mar 28, 2006
    #3
  4. Jo

    Dan Guest


    > So i will read from <font> till I encounter a </font>
    > It works fine..But i recently saw that certain webpages dont have
    > closing </font> tag for all <font>
    > Is it not necessary to put a </font> tag??
    >
    > What do i do now?


    Consider using CSS for fonts? Much tidier way of doing it... and yes
    <FONT> does need to be closed.

    Dan - Back in alt.html for '06
     
    Dan, Mar 28, 2006
    #4
  5. Jo

    kchayka Guest

    Benjamin Niemann wrote:
    > Jo wrote:
    >
    >> Is it not necessary to put a </font> tag??

    >
    > The end tag is mandatory. If it is missing, then the webpage is invalid.


    And you were expecting valid code from a page that uses <font>...? ;)

    --
    Reply email address is a bottomless spam bucket.
    Please reply to the group so everyone can share.
     
    kchayka, Mar 28, 2006
    #5
  6. Jo

    Andy Dingley Guest

    On 28 Mar 2006 07:59:58 -0800, "Jo" <> wrote:

    >i jus need to know whether font tag in HTML does not require a </font>
    >tag.


    It doesn't require a <font> tag either. Don't use either of them.


    if you absolutely _MUST_, then refactor this to use
    <span style="font-family: sans-serif; font-size: 120%" >
    and yes, they should be closed, paired and nested without interleaving
    (if you must nest them).

    But dump font and go to CSS. CSS can be tricky for some aspects, but
    using it to control fonts is easy enough.
     
    Andy Dingley, Mar 29, 2006
    #6
  7. Jo

    Jo Guest

    Thanks..
    Im writing a HTML parser that removes the tags and keeps using sensible
    text. This is in C#.Its like a tool.But, can i add another tool to it
    like HTML Tidy to cleanup? Wud that be right?
    In webpages, i only want the main txt to be displayed and not the Side
    divisions on the left n right of the web page that mostly shows links
    to the other pages.
    I realised that in the web page im workin on now, has the right n left
    div inside font tag of their own specified class. So i will check
    whether its a font tag, then check for its class, if all are true, then
    i'll remove until a </font> tag comes. This was workin fine until one
    webpage showed me that </font> tag was missing for a <font> tag... Now
    what do i do?
    I have coded in C#..
     
    Jo, Mar 29, 2006
    #7
  8. Jo

    Jim Higson Guest

    Jo wrote:

    > Thanks..
    > Im writing a HTML parser that removes the tags and keeps using sensible
    > text. This is in C#.Its like a tool.But, can i add another tool to it
    > like HTML Tidy to cleanup? Wud that be right?
    > In webpages, i only want the main txt to be displayed and not the Side
    > divisions on the left n right of the web page that mostly shows links
    > to the other pages.
    > I realised that in the web page im workin on now, has the right n left
    > div inside font tag of their own specified class. So i will check
    > whether its a font tag, then check for its class, if all are true, then
    > i'll remove until a </font> tag comes. This was workin fine until one
    > webpage showed me that </font> tag was missing for a <font> tag... Now
    > what do i do?
    > I have coded in C#..


    Writing an error-tollerent HTML/SGML parser takes a long time. Do you have
    to do this (ie it is for a school project) or could you use a preexisting
    one?

    TagSoup is a pretty good parser for bad HTML. See:
    http://www.idealliance.org/papers/xml02/dx_xml02/html/abstract/05-06-06.html

    TagSoup is in Java, but not every part of a project has to be in the same
    language.

    --
    Jim
     
    Jim Higson, Mar 29, 2006
    #8
  9. Jo

    Chaddy2222 Guest

    Jo wrote:
    > Hello evryone...
    > i jus need to know whether font tag in HTML does not require a </font>
    > tag.
    > Me parsing out text from web page source code. I have to remove the
    > entire tag
    > <font >
    > Any text
    > </font>
    >
    > So i will read from <font> till I encounter a </font>
    > It works fine..But i recently saw that certain webpages dont have
    > closing </font> tag for all <font>
    > Is it not necessary to put a </font> tag??
    >
    > What do i do now?
    > Kindly help..

    Yes, you need to add the </font> tag in to close that tag.
    If you do not do that then your code will not be valid.
    --
    Regards Chad. http://freewebdesign.cjb.cc
    >
    > Cheers
    > Annie(Jo)
     
    Chaddy2222, Mar 29, 2006
    #9
  10. Jo wrote:

    > Thanks..
    > Im writing a HTML parser that removes the tags and keeps using sensible
    > text. This is in C#.Its like a tool.But, can i add another tool to it
    > like HTML Tidy to cleanup? Wud that be right?


    It can save you a lot of time. Tidy could also convert HTML to XHTML, which
    could be then parsed with an XML parser and you can analyze the contents
    more conviently with stuff like XPath, ...
    For C# the article <http://www.devx.com/dotnet/Article/20505/0/page/1> may
    help.

    --
    Benjamin Niemann
    Email: pink at odahoda dot de
    WWW: http://pink.odahoda.de/
     
    Benjamin Niemann, Mar 29, 2006
    #10
  11. Jo

    Jo Guest

    Hello Jim...
    Yes, im writing a HTML parser as my project. Its been written in C#.
    Now, the issue is with web page that don have proper closing
    tags.Otherwise it works just fine.
    My HTML parser works just fine...except for web pages that have no
    proper closing tags cos my checks in de code checks for opening and
    closing tags and removes the entire structure together.

    Kindly help

    Cheers
    Jo
     
    Jo, Mar 29, 2006
    #11
    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. Karl Hungus

    Font class, external font files question

    Karl Hungus, Feb 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    565
    Karl Hungus
    Feb 4, 2004
  2. =?Utf-8?B?Tmlja3k=?=
    Replies:
    2
    Views:
    732
    Matt Berther
    Feb 20, 2005
  3. Michael Glavitsch
    Replies:
    1
    Views:
    795
    Roedy Green
    Jul 15, 2003
  4. shruds
    Replies:
    1
    Views:
    932
    John C. Bollinger
    Jan 27, 2006
  5. mttc
    Replies:
    2
    Views:
    2,459
    Roedy Green
    Jul 3, 2009
Loading...

Share This Page