c# - Identify Duplicate Nodes in XML Using XPath -
i trying identify duplicate group nodes in following xml structure. need find groups same name, wherever in tree.
<report> <group name="a"> <group name="1"></group> <group name="2"></group> </group> <group name="b"> <group name="1"></group> </group> </report>
similar post (how identify duplicate nodes in xpath 1.0 using xpathnavigator evaluate?) however, need identify groups same attribute rather same node value.
how using linq xml find duplicates?
var dubs = xdocument.parse(xml) .descendants("group") .groupby(g => (string)g.attribute("name")) .where(g => g.count() > 1) .select(g => g.key);
Comments
Post a Comment