How I can find in XPath 1.0 all rows with empty col name="POW"
?
<row>
<col name="WOJ">02</col>
<col name="POW"/>
<col name="GMI"/>
<col name="RODZ"/>
<col name="NAZWA">DOLNOŚLĄSKIE</col>
<col name="NAZDOD">województwo</col>
<col name="STAN_NA">2011-01-01</col>
</row>
I tried many solutions. Few times in Firefox extension XPath Checker selection was ok, but lxml.xpath()
says that expression is invalid or just returns no rows.
My Python code:
from lxml import html
f = open('TERC.xml', 'r')
page = html.fromstring(f.read())
for r in page.xpath("//row[col[@name = 'POW' and not(text())]]"):
print r.text_content()
print "-------------------------"