Page 1 of 1

Find all/ Replace all particular attributes only

Posted: Thu Jul 25, 2019 11:37 pm
by farizz145
Hi Guys,

So, I have a bunch of XML files, where the label size is a bit small, so, I want to change only the height, which is the fourth element of the layout attribute, while the other factors remain the same, so, the text is not cut-off. How can I do that at once, using for eg, Find all in Oxygen. Here is an example of a line present in all scripts. I am able to find them all at once, using find all, but cannot replace them all without modifying all the elements.

<BoundLabel layout="370.0,225.0,50.0,10.0" font="bold 11.0pt Tahoma" foreground="green" halign="left" mouseOver="highlight">

In the above line, I want to change 10 to 25, while other elements retain their values.

Re: Find all/ Replace all particular attributes only

Posted: Fri Jul 26, 2019 8:54 am
by Radu
Hi,

Oxygen's Find/Replace dialog has an "Xpath" field which you can set to //BoundLabel/@layout in order to limit the search.
Then enable the "Regular Expression" checkbox and search for:

Code: Select all

(\d*\.\d),(\d*\.\d),(\d*\.\d),(\d*\.\d)
replace with:

Code: Select all

\1,\2,60.0,\4
Basically I'm matching all four numbers and replacing keeping the first, second and fourth unmodified but with a custom value for the third one.

Another way to do this if you are comfortable with writing XSLT or XQuery would be to write a custom XSLT stylesheet and use it in an XML refactoring operation.

https://www.oxygenxml.com/doc/versions/ ... tools.html

Regards,
Radu