Swapping XML Tags

General questions about using WildEdit

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
trespasser
Posts: 11
Joined: Wed Jul 02, 2003 6:48 am

Swapping XML Tags

Post by trespasser »

Hi All,

i have been informed previously that there are a few things that can be done in WildEdit to XML files. I have a large amount of XML files, about 400 where I need to swap the contents of the <FormalStatement> Tag with the contents of the <Paragraph> Tag that comes directly after it. Is this something that can be done quite quickly on all these files without having to copy and paste the data on each individual file.

Hope someone can help.

Thanks Phil
ben_josephs
Posts: 2459
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Do you want to change

Code: Select all

<FormalStatement>
paragraph data
paragraph data
</FormalStatement>
<Paragraph>
formalstatement data
formalstatement data
</Paragraph>
to

Code: Select all

<FormalStatement>
formalstatement data
formalstatement data
</FormalStatement>
<Paragraph>
paragraph data
paragraph data
</Paragraph>
?

Try
Find what:
<FormalStatement>(.*?)</FormalStatement>(\s*)<Paragraph>(.*?)</Paragraph>

Replace with:
<FormalStatement>$3</FormalStatement>$2<Paragraph>$1</Paragraph>
Select Regular expression.
Select Replacement format.
Unselect the option '.' does not match a newline character.
Post Reply