Wednesday, 21 September 2011

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)]

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

C# Reactive Extensions - Buffer and Window

I was going through Buffer and Window in RX, thought a few examples would help clear the differences. First create a buffer of even numbe...