Here what I wanted you to do.
There is a few XML custom markup tags and it should convert to XHTML.
For example:
$data = <html> <head> <title> Blah Blah </title> </head> **<sn:heading underline="true">This is the heading</sn:heading>** </html>
then it should convert to:
$output = <html> <head> <title> Blah Blah </title> </head> **<h1><u>This is the heading</u></h1>** </html>
you also need to do:
<sn:redirect url="[login to view URL]" />
<sn:if-is-own-profile> Welcome back to your profile! <sn:else>This is not your profile.</sn:else> </sn:if-is-own-profile>
That is it.