Page 1 of 1

Swapping XML Tags

Posted: Fri Apr 28, 2006 9:32 am
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

Posted: Fri Apr 28, 2006 11:05 am
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.