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

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -