How I can find in XPath 1.0 all rows with empty col name="POW"
?
There are many possible definitions of "empty" and for each one of them there is a different XPath expression selecting "empty" elements.
A reasonable definition for an empty element is: an element that has no children elements and no text-node children, or an element that has a single text-node child, whose string value contains only whitespace characters.
This XPath expression:
//row[col[@name = 'POW']
[not(*)]
[not(normalize-space())]
]
selects all row
elements in the XML document, that have a col
child, that has an attribute name
with string value "POW"
and that has no children - elements and whose string value consists either entirely of whitespace characters, or is the empty string.
In case by "empty" you understand "having no children at all", which means no children elements and no children PI nodes and no children comment nodes, then use:
//row[col[@name = 'POW']
[not(node())]
]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…