Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #2137

Reading XML to relational tables

From Ted Flethuseo <flethuseo@gmail.com>
Newsgroups comp.lang.ruby
Subject Reading XML to relational tables
Date Fri, 1 Apr 2011 17:47:22 -0500
Organization Service de news de lacave.net
Lines 46
Message-ID <236f02bc699a9c809bdec25e00a2d0f2@ruby-forum.com> (permalink)
NNTP-Posting-Host bristol.highgroove.com
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
X-Trace talisker.lacave.net 1301698078 79027 65.111.164.187 (1 Apr 2011 22:47:58 GMT)
X-Complaints-To abuse@lacave.net
NNTP-Posting-Date Fri, 1 Apr 2011 22:47:58 +0000 (UTC)
X-Received-From This message has been automatically forwarded from the ruby-talk mailing list by a gateway at comp.lang.ruby. If it is SPAM, it did not originate at comp.lang.ruby. Please report the original sender, and not us. Thanks! For more details about this gateway, please visit: http://blog.grayproductions.net/categories/the_gateway
X-Mail-Count 380782
X-Ml-Name ruby-talk
X-Rubymirror Yes
X-Ruby-Talk <236f02bc699a9c809bdec25e00a2d0f2@ruby-forum.com>
Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!talisker.lacave.net!lacave.net!not-for-mail
Xref x330-a1.tempe.blueboxinc.net comp.lang.ruby:2137

Show key headers only | View raw


Hi everyone,

I need to build 3 relational tables from an xml text. In this tables, I
need to keep track of words that have the <emph> and <bold> tags in them
along with the
word mentioned and its count in the <p> tag. This is easier to
illustrate with an example:

I need to take this text:

<p> My name is <strong>Ted</strong>, and I like <emph>coffee</emph>.
<strong>Ted</strong> does not like tea. </p>
<p> I have a brother who likes <emph>tea</emph> but does not like
<emph>coffee</emph> </p>

To 3 normalized tables like this:

..p_table...
p_id    desc
1       My name is....
2       I have a ....


..p_to_emph_table...
p_id    e_id    count
1       2       1
2       1       1
2       2       1


..emph_table...
e_id    emph_word
1       Tea
2       Coffee

I am not sure what would be the best approach to parse this xml with
ruby or what tool
could help me do this efficiently?

Any ideas appreciated,

Ted.

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Reading XML to relational tables Ted Flethuseo <flethuseo@gmail.com> - 2011-04-01 17:47 -0500
  Re: Reading XML to relational tables Jesús Gabriel y Galán <jgabrielygalan@gmail.com> - 2011-04-01 18:02 -0500
  Re: Reading XML to relational tables Ted Flethuseo <flethuseo@gmail.com> - 2011-04-09 16:39 -0500
    Re: Reading XML to relational tables Jesús Gabriel y Galán <jgabrielygalan@gmail.com> - 2011-04-11 02:56 -0500

csiph-web