I'm trying to parse a well formed xhtml document.
I'm having problems during the nodes iteration.
My xHtml has a structure like
<?xml version="1.0" encoding="UTF-8"?>
<html>
<head>...</head>
<body>
...
<form>
...
<div class="AB"> (1 or 2 times)
...
<div class="CD">
...
<table>
<tbody>
<tr> (1 to N times)
<td> XXX </td>
<td> YYY </td> ...
The information I need is contained in the columns (td).
I want to construct N objects. So every row (tr) contains in its columns the info I need to construct an object.
I've 1 or 2 div of class="AB". So basically I'll have 1 or 2 objects AB containing a list of other objects created from every row in the table
So at first I extract a NodeList of these AB divs
NodeList ABlist= (NodeList) xpath.evaluate("//div[@class='AB']", document, XPathConstants.NODESET)
Now I'm trying to get a NodeList of all the tr elems of the first div AB.
NodeList trList = (NodeList) xpath.evaluate("/div/table//tr", ABlist.item(0), XPathConstants.NODESET);
In this case the trList is empty. Do you know what's wrong with my code?
Thank you