Find and replace query

Questions about XML that are not covered by the other forums should go here.
GrenadaV
Posts: 6
Location: New Zealand

Find and replace query

Wed Oct 29, 2014 5:47 am

Hi there,
I hjave an xml doc that needs to change for it to be used with our software (Adobe Captivate)we use xml to import as a glossary for any eLearning modules we produce.

Problem I am having is with the find and replace options where I need one ting to change to another, but there are 2 of the others as per below....

<label>
<label>Collateral </label>
<def>Property pledged to secure a loan or debt.</def>
</label>
I want to change this to read <term><label>
But I also have the word label here which I do not want to change<label>Combined Court</label>
<def>A Court that has both High Court and District Court sittings.</def>
and this to </term></label>
<label>
<label>Compensatory damages</label>
<def>Money awarded to reimburse actual costs, such as medical bills and lost wages. Also awarded for things that are harder to measure, such as pain and suffering.</def>
</label>
<label>

How could I achieve this with a find and replace in my xml doc.
By the way It should be know, I am a novice at this :-)

Any help appreciated
Kind Regards
Rossco
adrian
Posts: 2443

Re: Find and replace query

Wed Oct 29, 2014 5:58 pm

Hi,

So, as a rule, you need to rename the first level label elements that contain another label element into term and keep the nested (second level) label elements as they are.

This operation is more suited for the specialized Refactoring > Rename Element action than Find/Replace. To do this:
1. Right click on one of the label tags that you want to rename and from the contextual menu pick Refactoring > Rename Element.
2. In the Rename dialog change the name and select the second option, "Rename siblings with the same name".
3. Press OK. This will rename all the label elements from that level and leave the nested label elements as they are.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
GrenadaV
Posts: 6
Location: New Zealand

Re: Find and replace query

Wed Oct 29, 2014 11:57 pm

Brilliant Adrian,
worked a treat...

Thanks very much

Rossco

Return to “General XML Questions”

Who is online

Users browsing this forum: No registered users and 0 guests