IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

How to Search for Duplicate XML Tags in an XML File Options · View
Jennifer Aguilera
Posted: Friday, January 30, 2015 2:38:52 AM
Rank: Newbie

Joined: 1/30/2015
Posts: 1
Location: San Antonio
Does anyone know a way to search through several thousand xml files at once and have items flagged which contain a duplicate xml reference?

For instance, I need to know which xml files contain more than one reference of:

correct="true"

I need a way to do this without having to physically open each xml file and search manually for items where this reference is used more than one time.

Any help would be greatly appreciated.
vlad
Posted: Friday, January 30, 2015 8:59:40 AM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
You can do it with XPath - you can apply it to a whole Project or a folder with files, so no need to open each file independently.

Your description of the reference is not clear, but assuming you are just looking for more than one concurrence of this pair, the XPath would be

count( //@correct[ . = 'true' ] )[ . > 1 ]

This will only output those files which have more than one pair correct="true" in it
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.