Professional Web Applications Themes

HTML/XML Parsing... - Ruby

I'm wondering if anyone ever come across an example on how to p an html table(with images) using either XSLT or Ruby scripts. I'd like to be able to extract all the data and put them in the database(MySQL, SQLite, etc). There's a twist though, some of the image cells has 2 or more jpeg images instead of one. Since I'm not an expert database designer, how do you do that? Table fields: ------------ xnum text(40) unique image jpeg image (may have none, or 1+ images) desc memo(256) loc memo(256) Thanks....

  1. #1

    Default HTML/XML Parsing...

    I'm wondering if anyone ever come across an example on how to p an html
    table(with images) using either XSLT or Ruby scripts.

    I'd like to be able to extract all the data and put them in the
    database(MySQL, SQLite, etc).

    There's a twist though, some of the image cells has 2 or more jpeg images
    instead of one. Since I'm not an expert database designer, how do you do
    that?

    Table fields:
    ------------
    xnum text(40) unique
    image jpeg image (may have none, or 1+ images)
    desc memo(256)
    loc memo(256)

    Thanks.



    Ruby Guest

  2. #2

    Default Re: HTML/XML Parsing...

    My first suggestion would be to
    1. make a to-many relationship to the image records,
    2. to store any IMG attributes pd from the HTML in the image records
    themselves (with maybe an ordering attribute within the to-many set, in case
    sliced images are bumped up against each other for positioning), and
    3. To decide whether to store the images themselves on a filesystem with
    pathnames in the records, or to store image data as BLOBS within the records
    themselves.

    If you need to retrieve the images through a non-HTTP pipeline into another
    process, then BLOBS may be the way to go. If I was simply going to generate
    dynamic HTML, then I'd probably go ahead and put the images out on a
    filesystem where both the database and the Webserver could get to 'em.

    - dan




    "Ruby Tuesday" <com> wrote in message
    news:c1gidb$1j6abi$news.uni-berlin.de... 
    html 


    dhtapp Guest

  3. #3

    Default Re: HTML/XML Parsing...

    "Ruby Tuesday" <com> wrote in message
    news:c1gidb$1j6abi$news.uni-berlin.de... 

    It's been a while since I worked with databases, but perhaps something
    like this:

    table 1: "cells"
    - id int autoincrement primary_key
    - xnum text(40) unique
    - desc ...
    - loc ...

    table 2: "images"
    - id int autoincrement primary_key
    - cell_id int index
    - image blob


    that way, more than one image could be linked to the same cell_id. then:

    SELECT image, xnum FROM images, cells WHERE cell_id = cells.id;

    ...to select a list of records conating to fields: image data, and cell
    numbers (assuming that's what the xnum is)

    Alternatively, you could forgo the ids, and link images via xnums. But
    I understand that using ids is the "right" way, whatever that means. :)



    Mark Guest

Similar Threads

  1. Parsing HTML
    By Mohammad-Reza in forum ASP.NET Web Services
    Replies: 10
    Last Post: February 26th, 10:49 PM
  2. parsing HTML
    By Andrew in forum PERL Beginners
    Replies: 6
    Last Post: July 22nd, 02:15 PM
  3. HTML Parsing?
    By Martin in forum Ruby
    Replies: 11
    Last Post: February 11th, 01:31 AM
  4. HTML parsing
    By Gavin in forum Ruby
    Replies: 4
    Last Post: February 2nd, 02:03 PM
  5. Parsing Html
    By Colum in forum PHP Development
    Replies: 2
    Last Post: October 30th, 10:22 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139