XPath Query in file compare

Questions about XML that are not covered by the other forums should go here.
Posts: 58
Joined: Wed Aug 30, 2017 3:56 pm

Re: XPath Query in file compare

Post by teo »


The expression you used excludes from comparison all the attributes called "name", simply not taking into account their values.
But it seems that you intend to exclude only certain elements, those for which the "name" attribute has a certain value.

You should try then an XPath of the form: //queryExpression[@name="ATTR_VALUE_USED_FOR_EXCLUSION"]
ATTR_VALUE_USED_FOR_EXCLUSION could also be expressed using a RegExp if you use matches() function, available with XPath 2.0.

An absolute random example: queryExpression[matches(@name,'q[a-z]+t')]
That RegExp actually means a pattern for the value of the "name" attribute: it starts with the letter 'q', ends with the letter 't', and between them there can be any other letters.

I hope I understood your use case well and you'll find my explanations useful.

Teodor Timplaru
<oXygen/> XML Editor