SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Parsing HTML

Hybrid View

  1. #1
    SitePoint Addict dotancohen's Avatar
    Join Date
    Aug 2005
    Location
    Haifa
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Parsing HTML

    I just noticed that the firefox bookmarks page in over 500KB, while it displays only 22KB of text on the screen. I carry this file with me on my disk-on-key so it is important for it to be small.

    I want to parse entrys like this too make them smaller:
    <a href="http://www.aximsite.com/articles/link.php?id=22"
    add_date="1130275531" last_charset="windows-1252"
    id="rdf:#$FOQot">Knowledge Base: What Can I Do With My Axim?</a>

    I want to parse it to remove the attributes add_date, last_charset,
    id, and others that are in other entries. One of the atributes is a represantaion of the favicon, which is too big to post here! The regexes that I was trying were oleaving me with things like: <a></a>, <>, <a href="http://address" ="something" ="somehing else">blahblah</a>. Also, I was unable to parse the WHOLE file at once- my test code would only work if on one entry at a time- thats impractical.

    Any ideas? Thanks.
    . Have a question?
    . . What Is Firefox?
    . . . . What Is Open Office?
    . . . . . . What Is What?

  2. #2
    SitePoint Zealot erikwebb's Avatar
    Join Date
    Dec 2003
    Location
    Atlanta, GA
    Posts
    150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First of all, the bookmarks file for Firefox is XML, not HTML. Second, I'm not sure what attributes Firefox requires and which are optional. Might want to do some research on the structure of bookmarks.xml before you start hacking out stuff that looks "optional".

  3. #3
    SitePoint Addict dotancohen's Avatar
    Join Date
    Aug 2005
    Location
    Haifa
    Posts
    315
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They are all optional other than href. I already checked.
    . Have a question?
    . . What Is Firefox?
    . . . . What Is Open Office?
    . . . . . . What Is What?


Bookmarks

Posting Permissions

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