Thursday, 1 January 2015

List all td nodes with empty content



I am using java 1.6. I am having the xml strcuture like below.




- <table column="6" row="22">
- <tr>
<td bold="true" class="header" font="Arial Narrow" size="9">Jinesh</td>
<td align="Right" bold="true" font="Arial Narrow" size="9">2007</td>
<td align="Right" bold="true" font="Arial Narrow" size="9">2008</td>
<td align="Right" bold="true" font="Arial Narrow" size="9">2009E</td>
<td align="Right" bold="true" font="Arial Narrow" size="9">2010E</td>
<td align="Right" bold="true" font="Arial Narrow" size="9">2011E</td>
</tr>
<tr>
<td font="Arial Narrow" size="9" />
<td font="Arial Narrow" size="9" />
<td font="Arial Narrow" size="9" />
<td font="Arial Narrow" size="9" />
<td font="Arial Narrow" size="9" />
<td font="Arial Narrow" size="9" />
</tr>


Now I want to list all the td node with empty content such as in the second tag does not have any contents.Currently I am using the below Xpath expression to list out all the td nodes.



//table//tr//td[@font='Arial Narrow' and @size='9']


But the above expression list all the td nodes whether it is empty or not. Can anybody please help me with xpath expression to list all td nodes with empty content?


No comments:

Post a Comment