Page 1 of 1

changing only one element within an XML document

Posted: Wed Jul 13, 2011 2:24 pm
by Geoff16W
I need some oxygenxml 101 help.

I have a XML document with a one element that I want to change (while the content within that element stays the same), but I don't want to have to write a separate XSLT sheet just to transform one element.

So suppose I have a <p></p> element. Can you please explain to me how I can use Oxygen to change all <p></p> to <h></h>, again while the content remains the same?

Can I do this in the simple find and replace function? If so can you explain how?

Thank you very much,
jw

Re: changing only one element within an XML document

Posted: Wed Jul 13, 2011 4:37 pm
by adrian
Hello,

You could use the Find/Replace to do this but you would have to check too many options to achieve this("Whole word only", "Enable XML Search options", Search only in "Element names").

It's a lot simpler to use the specialized Rename Element action:
- In the editor right click on the element name and from the popup/contextual menu choose Refactoring -> Rename Element(Alt+Shift+R)
- In the Rename dialog specify the new name(e.g. 'h') and choose the scope of the rename: the current element, the element and its siblings or all the elements with that name(you'll probably want this last one).

Regards,
Adrian

Re: changing only one element within an XML document

Posted: Thu Jul 14, 2011 8:41 am
by Geoff16W
Very helpful, Adrian, Thanks so much.