Menu

How to get rows splitted

Help
good
2006-11-06
2012-09-04
  • good

    good - 2006-11-06

    My Config file is
    <loop item="row">
    <list>
    <xpath expression="//tr/td/p/span" id ="guruji_expr">
    <html-to-xml id="guruji_html">
    <http url="http://guruji.com/local?q=travels+chennai"/>
    </html-to-xml>
    </xpath>
    </list>
    <body>
    <xquery>
    <xq-param name="doc"><var name="row"/></xq-param>
    <xq-expression><![CDATA
    for $row in $doc
    return
    <travel>
    <Phone>{normalize-space(data($row/span[1
    ))}/Phone>
    </odds>]]></xq-expression>
    </xquery></body></loop><![CDATA[ </travel> ]]>
    I got the results. But still i want to split the single row with the name address and phone in seperate HTML tags. Where did I miss????

     
    • good

      good - 2006-11-06

      I tried this. But The same results came. Even before only the first data is tagged. But all other rows are not splitted.

       
    • Vladimir Nikic

      Vladimir Nikic - 2006-11-06

      It seems that document has firm structure - you better rely on class attribute values.
      You may use something like this in XQuery:

      <xquery>
      <xq-param name="doc">
      <var name="doc"/>
      </xq-param>
      <xq-expression><![CDATA
      for $row in $doc//tr/td/p return
      <travel>
      <name>{normalize-space(data($row/span[@class='Result10'
      ))}</name>
      <address>{normalize-space(data($row/span[@class='Result3']))}</address>
      <phone>{normalize-space(data($row/span[@class='Result2']))}</phone>
      </travel>
      ]]></xq-expression>
      </xquery>

      I didn't check this - you try it.

       

Log in to post a comment.