This is not going to be easy. It is easy enough to parse the XML parsing the XML into a XDocument:
string str =
@"
<!-- comment at the root level -->
<root>
<child>Content</child>
</root>";
XDocument doc = XDocument.Parse(str);
This will allow you to get to all the information in the xml, including the content of the script tag by using the following
child = doc.Descendants("Child").FirstOrDefault();
Console.WriteLine(child.Value);
Unfortunately, still have to parse the content of the script tag. That will require you to go through and do the hard work. What I recommend is to use regular expressons. I am not an expert at working with regular experssions, and it is going to require some fancy stuff to do the extraction, but I have seen some really neat stuff with regular expressons, for instance C# Formula Evaluator using Regular Expressions (
http://www.jarloo.com/c-formula-evaluator[
^]). You will have to read up on regular expressons.