public static DefaultHighlightingStrategy Parse(SyntaxMode syntaxMode, XmlTextReader xmlTextReader)
        {
            try {
                XmlValidatingReader validatingReader = new XmlValidatingReader(xmlTextReader);
                Stream shemaStream = Assembly.GetCallingAssembly().GetManifestResourceStream("Mode.xsd");
                validatingReader.Schemas.Add("", new XmlTextReader(shemaStream));
                validatingReader.ValidationType = ValidationType.Schema;
                validatingReader.ValidationEventHandler += new ValidationEventHandler (ValidationHandler);

                XmlDocument doc = new XmlDocument();
                doc.Load(validatingReader);

                DefaultHighlightingStrategy highlighter = new DefaultHighlightingStrategy(doc.DocumentElement.Attributes["name"].InnerText);

                if (doc.DocumentElement.Attributes["extensions"]!= null) {
                    highlighter.Extensions = doc.DocumentElement.Attributes["extensions"].InnerText.Split(new char[] { ';', '|' });
                }
                /*
                if (doc.DocumentElement.Attributes["indent"]!= null) {
                    highlighter.DoIndent = Boolean.Parse(doc.DocumentElement.Attributes["indent"].InnerText);
                }
                */
                XmlElement environment = doc.DocumentElement["Environment"];

                highlighter.SetDefaultColor(new HighlightBackground(environment["Default"]));

                foreach (string aColorName in environmentColors) {
                    highlighter.SetColorFor(aColorName, new HighlightColor(environment[aColorName]));
                }

                // parse properties
                if (doc.DocumentElement["Properties"]!= null) {
                    foreach (XmlElement propertyElement in doc.DocumentElement["Properties"].ChildNodes) {
                        highlighter.Properties[propertyElement.Attributes["name"].InnerText] =  propertyElement.Attributes["value"].InnerText;
                    }
                }

                if (doc.DocumentElement["Digits"]!= null) {
                    highlighter.SetColorFor("Digits", new HighlightColor(doc.DocumentElement["Digits"]));
                }

                XmlNodeList nodes = doc.DocumentElement.GetElementsByTagName("RuleSet");
                foreach (XmlElement element in nodes) {
                    highlighter.AddRuleSet(new HighlightRuleSet(element));
                }

                xmlTextReader.Close();

                if(errors!=null) {
                    ReportErrors(syntaxMode.FileName);
                    errors = null;
                    return null;
                } else {
                    return highlighter;
                }
            } catch (Exception) {
                //MessageBox.Show("Could not load mode definition file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return null;
            }
        }
 void CreateDefaultHighlightingStrategy()
 {
     DefaultHighlightingStrategy defaultHighlightingStrategy = new DefaultHighlightingStrategy();
     defaultHighlightingStrategy.Extensions = new string[] {};
     defaultHighlightingStrategy.Rules.Add(new HighlightRuleSet());
     highlightingDefs["Default"] = defaultHighlightingStrategy;
 }