Prox search using tags

<oXygen/> general issues.
bcalla8
Posts: 6
Joined: Thu Nov 26, 2020 1:21 am

Prox search using tags

Post by bcalla8 » Thu Nov 26, 2020 1:45 am

Hi - thanks in advance for the advice. Running Oxygen 22.1

I need to replace one designation - (OS) - with a different designation (A) in *some* cases - namely when the type of the container is "flatfile". We have other OS material for which the OS designation will just be removed.

So:

<container type="flatfile">134 (OS)</container>
becomes
<container type="flatfile">134 (A)</container>

While:
<container type="port">5 (OS)</container>
becomes
<container type="port">5</container>

So my plan was to use a prox search to first replace all the 'flatfile' materials designations (searching: "flatfile OS"~10), and then do a regular search/replace with the OS to simply remove those that are left.

But I'm having some trouble with... well, all proximity searches, to be honest. I figured initially the problem was that I was asking it to find something within a tag and something in the data, but even the basic prox searches I'm doing don't seem to be working. I tried it just within data and it also wasn't working. So not I'm not sure what I'm doing wrong.

Constructed my plan/searches from the documentation:
Proximity Searches

Use proximity searches to find words that are within a specific distance away. To perform a proximity search, use the ~ symbol at the end of your search. For example, to search for the word Garden and the word Preparation within 6 words of each other use:
"Garden Preparation"~6
Any thoughts on what I'm doing wrong here? Thanks very much.

adrian
Posts: 2717
Joined: Tue May 17, 2005 4:01 pm

Re: Prox search using tags

Post by adrian » Thu Nov 26, 2020 6:17 pm

Hello,

You've found "Proximity Searches" in the Searching in Content section from the documentation which refers to a feature available in the Open/Find Resource dialog which only works on indexed content from the project.
Also note that Open/Find Resource is just a content locating tool, it does not have replace capabilities.

For replace operations either try Find > Find/Replace (or Find > Find/Replace in Files) or refactoring operations, Tools > XML Refactoring.

If you use Find/Replace (or Find/Replace in Files) try:
Find: (OS)
XPath: //container[@type='flatfile']

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

bcalla8
Posts: 6
Joined: Thu Nov 26, 2020 1:21 am

Re: Prox search using tags

Post by bcalla8 » Mon Nov 30, 2020 8:49 pm

I'll give it a try - thanks!

bcalla8
Posts: 6
Joined: Thu Nov 26, 2020 1:21 am

Re: Prox search using tags

Post by bcalla8 » Mon Nov 30, 2020 9:04 pm

This worked perfect - exactly what I needed. Thanks so much!

Post Reply