XPath Query in file compare
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 81
- Joined: Wed Aug 30, 2017 3:56 pm
Re: XPath Query in file compare
Hello,
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.
Regards,
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.
Regards,
Teo
Teodor Timplaru
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service