XML: Find out node which doesn’t have a given attribute

Question: Find out a node which doesn't have a given attribute.
For e.g., in the given xml, get the third Child node which doesn’t have the attribute ‘name’.

<?xml version="1.0" encoding="UTF-8"?>
	<Child name='A' />
	<Child name='B' />
	<Child />
	<Child age='30'/>

XPath to find nodes without ‘name’ attribute

XPath to find nodes without ‘name’ and ‘age’ attribute
/Children/Child[not (@name) and not(@age)]


Popular posts from this blog

Wix: How to hide the License Agreement dialog in Mondo UI

WPF: TreeView example (Part 4)