Page 1 of 1

Global unwrapping

Posted: Tue Sep 21, 2021 12:47 pm
by david_himself
Hi

I want to remove the <seg> tags from every XML file in a project, but

(1) only in body, not teiHeader
(2) regardless of attributes and values
(3) leaving the enclosed material untouched
(4) not adding extra spaces

Were it not for condition (1), it would be easy with regex. Example. Change

my advice <seg type="bodySalute"><rs ref="psn:MH">my Friend</rs>,</seg> I give it you

to

my advice <rs ref="psn:MH">my Friend</rs>, I give it you

How? Thanks in advance.

best
David

Re: Global unwrapping

Posted: Tue Sep 21, 2021 2:23 pm
by Radu
Hello David,

In the Oxygen main menu Tools->"XML Refactor" you will find an "Unwrap element" action, it can work over multiple files and you need to pass to it an XPath for the element to unwrap, for example maybe in your case "//*:body//*:seg".

Regards,
Radu

Re: Global unwrapping

Posted: Tue Sep 21, 2021 2:31 pm
by david_himself
Thanks, Radu. I had already experimentally tried Refactoring in the Document menu of a single file, but the operation was unavailable there. It looks as if it will be available in the right-click menu for the project or the file folder. I will cautiously have a go. Many thanks for prompt reply.

best
David