0

I am scrapping the data using web-harvest tool and i am getting the required data i.e. name and price of the product.

here is my config file.

<include path="functions.xml"/>

<!-- collects all tables for individual products -->
<var-def name="products">    
    <call name="download-multipage-list">
        <call-param name="pageUrl">http://www.amazon.de/s/ref=nb_sb_noss?__mk_de_DE=AMAZON&amp;url=search-alias%3Daps&amp;field-keywords=AT300-103%20TEGRA%203%201GB</call-param>
        <call-param name="nextXPath">//a[@class="pagnNext"]/@href</call-param>
        <call-param name="itemXPath">//div[@class="fstRow prod"]</call-param>
        <call-param name="maxloops">10</call-param>
    </call>
</var-def>

<!-- iterates over all collected products and extract desired data -->            
<file action="write" path="reports/catalog.xml" charset="UTF-8">
    <![CDATA[ <catalog> ]]>
    <loop item="item" index="i">
        <list><var name="products"/></list>
        <body>
            <xquery>
                <xq-param name="item" type="node()"><var name="item"/></xq-param>
                <xq-expression><![CDATA[
                        declare variable $item as node() external;

                        let $name := data($item//*[@class='lrg bold'])
                        let $price := data($item//*[@class='bld lrg red'])
                            return
                                <product>
                                    <name>{normalize-space($name)}</name>
                                    <price>{normalize-space($price)}</price>
                                </product>
                ]]></xq-expression>
            </xquery>
        </body>
    </loop>
    <![CDATA[ </catalog> ]]>
</file>

now i am trying to move this name and price information to the mysql database table which contains two columns name and price. i got the information that we have to use database tag. but not getting information how to use that.

could you please assist me how can configure that in my config file.

Thanks in advance.

  • Sahiti
4

1 回答 1

0

请浏览 web-harvest.sourceforge.net/manual.php#database 并尝试按照给定的方式实施。

于 2013-07-17T05:25:42.080 回答