/// <summary> /// Constructs a new MarkupValidatorResponse to parse the data in the stream. /// </summary> /// <param name="stream"></param> public MarkupValidatorResponse(Stream stream) { var doc = new XmlDocument(); const string soapAlias = "e"; const string namespaceAlias = "m"; var nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace(soapAlias, "http://www.w3.org/2003/05/soap-envelope"); nsmgr.AddNamespace(namespaceAlias, "http://www.w3.org/2005/10/markup-validator"); doc.Load(stream); var faultNode = doc.SelectSingleNode(string.Concat("/", soapAlias, ":Envelope/", soapAlias, ":Body/", soapAlias, ":Fault"), nsmgr); if (faultNode != null) throw CreateFaultException(faultNode, nsmgr, soapAlias, namespaceAlias); var node = doc.SelectSingleNode(string.Concat("/", soapAlias, ":Envelope/", soapAlias, ":Body/", namespaceAlias, ":markupvalidationresponse"), nsmgr); _helper = new XmlHelper(node, nsmgr, namespaceAlias); _errors = new MarkupValidatorAtomicMessageList( _helper.Node.SelectSingleNode(string.Concat("child::", _helper.NamespaceAlias, ":errors"), _helper.NamespaceManager), _helper.NamespaceManager, _helper.NamespaceAlias, "error"); _warnings = new MarkupValidatorAtomicMessageList( _helper.Node.SelectSingleNode(string.Concat("child::", _helper.NamespaceAlias, ":warnings"), _helper.NamespaceManager), _helper.NamespaceManager, _helper.NamespaceAlias, "warning"); _debug = new Dictionary<string, string>(); var debugNodes = _helper.Node.SelectNodes(string.Concat("child::", _helper.NamespaceAlias, ":debug"), _helper.NamespaceManager); if (debugNodes != null) foreach (XmlNode debugNode in debugNodes) { _debug.Add(debugNode.Attributes["name"].Value, debugNode.InnerText); } }
internal MarkupValidatorAtomicMessage(XmlNode node, XmlNamespaceManager namespaceManager, string namespaceAlias) { _helper = new XmlHelper(node, namespaceManager, namespaceAlias); }