Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] How to properly parse HTML and XHTML Meta Tags

From: vonja:sbcglobal at: 11-Sep-2008 20:00

Hello Rebol Group, I'm a bit new, I have a couple of the Rebol books and have gone over the different tutorial a few times but I'm having trouble with the following code of mine. For example: I'm attempting to parse the meta tags but the tag can end in either
or "/>" I've tried to write the below script a different way, over 50 times, but to no avail. I don't know how to properly code it where it will check for either ending tag ">" or "/>" sample meta tag: <meta name="description" content="Having trouble with this below script" /> The end result should look like: Having trouble with this below script -not- Having trouble with this below script / If I change the script from ">" to "/>" and the meta tag is <meta name="description" content="Having trouble with this below script"> Then the script will not catch the ">" since it's looking for "/>" REBOL CODE: page: read http://www.rebol.com ; webpage to be parsed title: [] description: [] keywords: [] parse page [ thru <title> copy title to </title>] parse page [ thru "<meta name=^"keywords^" content=" copy keywords to
] parse page [ thru "<meta name=^"description^" content=" copy description to ">" ] print title print description print keywords Thank you in advance for your assistance. Regards, Von