I have a big XML file which contains some HTML
<Orchard>
<Recipe>
<Name>Generated by Orchard.ImportExport</Name>
<Author>admin</Author>
</Recipe>
<Data>
<BodyPart Text="<p>My HTML</p><p align ="center">blah blah</p>"/>
</Data>
</Orchard>
I want to encode the HTML, but leave the XML unencoded.
I’ve given regular expressions a shot but couldn’t come up with a solution.
Any ideas?
Cheers
Here’s my solution (not the most nicest way I know but it worked):
I moved the HTML into a CDATA as Brett Zamir suggested.
I then created a small program to parse the XML, find all the BodyPart items, and escape the HTML inside. Then moved the escaped HTML into the Text attribute, and deleted the inner text.