You currently don't have valid XML, so as a first step I recommend you surround it with some basic tags, for example:
var start = "Sandra <as type=\"1\">walked</as> in the park, and met a <as type=\"3\">random</as> stranger";
var startAsXml = "<root>" + start + "</root>";
Now we can parse it:
var doc = XElement.Parse(startAsXml);
Now we have two types of nodes in this XML - Text and Elements. You can easily loop through any number of ways and extract them, change them, do what you like. Here's an example:
foreach (var node in doc.Nodes())
{
if (node.NodeType == XmlNodeType.Text) Console.WriteLine("Text: {0}", node.ToString().Trim());
else if (node.NodeType == XmlNodeType.Element)
{
var element = (XElement)node;
Console.WriteLine("Element: Name={0} Type={1} Value={2}",
element.Name, element.Attribute("type").Value, element.Value);
}
}
This will print:
Text: Sandra
Element: Name=as Type=1 Value=walked
Text: in the park, and met a
Element: Name=as Type=3 Value=random
Text: stranger
Literalcontrol with a html to be displayed. Either way I suppose you should parse the string manually.typeattributes?