[xquery-talk] [SEARCHING XML FOR DATA] Total newbie question...

Petri Alessandro alessandro.petri at telecomitalia.it
Sat May 20 17:22:35 PDT 2006


Hi everyone. I'm doing a project for an university exam and i need advice on the xquery involved.
I developed an application which parses the HTML taken from a web page and translates it into a well formad XML.
I then query it through XQEngine java library. I basically want to extract from this URL: http://it.finance.yahoo.com/q/cp?s=%5EMIB30 the data from the central table. I'd like the return XML to be formed more or less this way:

<titolo>
   <codice>AL.MDD</codice>
   <nome>ALLEANZA ASS</nome>
   <prezzo>9,4900</prezzo>
   <variazione>-0,94%</variazione>
   <volumi>0</volumi>
</titolo>

for each table row. I really need some hints here as i can perform easy queries on the document but can't get to the one i need to extract this data.

Anticipated thanx to people who will answer :)

PS: the XML document i got from the transformed HTML is the following (Sorry if it's big):

<html>
  <head>
	...cut...
  </head>
  <body>
              <table
               width="100%"
               cellpadding="0"
               cellspacing="0"
               border="0"
               class="yfnc_tableout1">
                <tr>
                  <td>
                    <table
                     width="100%"
                     cellpadding="2"
                     cellspacing="1"
                     border="0">
                      <tr>
                        <td
                         class="yfnc_tablehead1"
                         align="center">Codice</td>
                        <td
                         class="yfnc_tablehead1"
                         align="center">Nome</td>
                        <td
                         class="yfnc_tablehead1"
                         align="center">Prezzo</td>
                        <td
                         class="yfnc_tablehead1"
                         align="center">Variazione</td>
                        <td
                         class="yfnc_tablehead1"
                         align="center">Volumi</td>
                      </tr>
                      <tr>
                        <td
                         class="yfnc_tabledata1">
                          <b>
                            <a
                             href="/q?s=AL.MDD">AL.MDD</a>
                          </b>
                        </td>
                        <td
                         class="yfnc_tabledata1">
                          <small>ALLEANZA ASS</small>
                        </td>
                        <td
                         class="yfnc_tabledata1"
                         align="center">
                        <b>9,4900 ?</b> 
                        <nobr>
                          <small>18 mag</small>
                        </nobr></td>
                        <td
                         class="yfnc_tabledata1"
                         align="center">
                        <img
                         width="10"
                         height="14"
                         border="0"
                         src="http://us.i1.yimg.com/us.yimg.com/i/us/fi/03rd/down_r.gif"
                         alt="Down" /> 
                        <b
                         style="color:#cc0000;">0,0900
                        (0,94%)</b></td>
                        <td
                         class="yfnc_tabledata1"
                         align="right">0</td>
                      </tr>
                      <tr>

            ...cut...

                        <td
                         class="yfnc_tabledata1">
                          <small>UNICREDITO ITALIANO</small>
                        </td>
                        <td
                         class="yfnc_tabledata1"
                         align="center">
                        <b>6,0650 ?</b> 
                        <nobr>
                          <small>18 mag</small>
                        </nobr></td>
                        <td
                         class="yfnc_tabledata1"
                         align="center">
                        <img
                         width="10"
                         height="14"
                         border="0"
                         src="http://us.i1.yimg.com/us.yimg.com/i/us/fi/03rd/down_r.gif"
                         alt="Down" /> 
                        <b
                         style="color:#cc0000;">0,1750
                        (2,80%)</b></td>
                        <td
                         class="yfnc_tabledata1"
                         align="right">0</td>
                      </tr>
                    </table>
                  </td>
                </tr>
              </table>
   	...cut...
</body>
</html>
--------------------------------------------------------------------

CONFIDENTIALITY NOTICE

This message and its attachments are addressed solely to the persons above and may contain confidential information. If you have received the message in error, be informed that any use of the content hereof is prohibited. Please return it immediately to the sender and delete the message. Should you have any questions, please contact us by replying to webmaster at telecomitalia.it.

        Thank you

                                        www.telecomitalia.it

--------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://xquery.com/pipermail/talk/attachments/20060520/119d776d/attachment.htm


More information about the talk mailing list