I am trying to get the value after the "<"strong">" - Tag ("TGCTGCTGC") out of a XML-file using "XPath". The query "//dns:table/dns:tbody//dns:tr/dns:td[contains(text(), 'genomic')]" gives the output "genomic-sequence", so far so good. However If I try to access the second "td", e.g. by writing "//dns:table/dns:tbody//dns:tr/dns:td[contains(text(), 'genomic')]/following-sibling::td[1]" or "//dns:table/dns:tbody//dns:tr/dns:td[contains(text(), 'genomic')]/following-sibling::td[2]" it never works. Below the xml-code:
"<tr>
<td style="text-align:right;">genomic-sequence</td>
<td>
<div style="overflow: auto; overflow-y: hidden;">
<strong>TGCTGCTGC</strong>
</div>
</td>
</tr>"
Thanks for your help!
I tried:
Works: "//dns:table/dns:tbody//dns:tr/dns:td[contains(text(), 'genomic')]" --> gives output "genomic-sequence"
Does not work: "//dns:table/dns:tbody//dns:tr/dns:td[contains(text(), 'genomic')]/following-sibling::td[1]" and "//dns:table/dns:tbody//dns:tr/dns:td[contains(text(), 'genomic')]/following-sibling::td[2]"
You need to specify the namespace for every element, even when using the following-sibling
axis:
following-sibling::dns:td
~~~~