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????
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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????
I tried this. But The same results came. Even before only the first data is tagged. But all other rows are not splitted.
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.