Is there an easy way to detect the existence of an empty attribute on an XPathNavigator XML node (e.g. <node> vs. <node attribute="">)? Node.GetAttribute returns an empty string either way. The only thing I can think of is checking the Node.OuterXML property, which seems like a really dumb approach.
(Note: the node won’t actually be empty, so I can’t just use Node.HasAttributes.)
You can use XPath:
This returns
null, if the the attributteattributedoesn’t exist, and anotherXPathNavigatorwithNodeTypeofAttributeandValuecontaining an empty string if the attribute exists, but is empty.