public static SchematronValidationResultPattern Parse(XPathNavigator navigator) { var document = navigator.GetAttribute("document", ""); var id = navigator.GetAttribute("id", ""); var name = navigator.GetAttribute("name", ""); var pattern = new SchematronValidationResultPattern(document, id, name); while (navigator.MoveToNext()) { if (navigator.LocalName != "fired-rule") { navigator.MoveToPrevious(); break; } var rule = SchematronValidationResultPatternRule.Parse(navigator); pattern.Rules.Add(rule); } return(pattern); }
public static SchematronValidationResult Parse(XmlDocument schematronResultDocument) { var navigator = schematronResultDocument.CreateNavigator(); var result = new SchematronValidationResult(); navigator.MoveToFirstChild(); var ns = navigator.NamespaceURI; if (navigator.LocalName != "schematron-output") { throw new IndexOutOfRangeException("Not a schematron result file."); } navigator.MoveToFirstChild(); while (navigator.NodeType != XPathNodeType.Element) { navigator.MoveToNext(); } do { switch (navigator.LocalName) { case "ns-prefix-in-attribute-values": result.NamespaceUri = navigator.GetAttribute("uri", ns); result.NamespacePrefix = navigator.GetAttribute("prefix", ns); break; case "active-pattern": result.Patterns.Add(SchematronValidationResultPattern.Parse(navigator)); break; } } while (navigator.MoveToNext()); return(result); }