private void PreprocessDiffgram(XmlDocument diffgramDoc) { // read xmldiff options XmlAttribute attr = (XmlAttribute)diffgramDoc.DocumentElement.Attributes.GetNamedItem("options"); if (attr == null) { throw new Exception("Missing 'options' attribute in the diffgram."); } string optionsAttr = attr.Value; var options = XmlDiff.ParseOptions(optionsAttr); _bIgnoreChildOrder = (((int)options & (int)(XmlDiffOptions.IgnoreChildOrder)) > 0); _bIgnoreComments = (((int)options & (int)(XmlDiffOptions.IgnoreComments)) > 0); _bIgnorePI = (((int)options & (int)(XmlDiffOptions.IgnorePI)) > 0); _bIgnoreWhitespace = (((int)options & (int)(XmlDiffOptions.IgnoreWhitespace)) > 0); _bIgnoreNamespaces = (((int)options & (int)(XmlDiffOptions.IgnoreNamespaces)) > 0); _bIgnorePrefixes = (((int)options & (int)(XmlDiffOptions.IgnorePrefixes)) > 0); _bIgnoreDtd = (((int)options & (int)(XmlDiffOptions.IgnoreDtd)) > 0); if (_bIgnoreNamespaces) { _bIgnorePrefixes = true; } // read descriptors XmlNodeList children = diffgramDoc.DocumentElement.ChildNodes; IEnumerator e = children.GetEnumerator(); while (e.MoveNext()) { XmlElement desc = e.Current as XmlElement; if (desc != null && desc.LocalName == "descriptor") { int opid = int.Parse(desc.GetAttribute("opid")); OperationDescriptor.Type type; switch (desc.GetAttribute("type")) { case "move": type = OperationDescriptor.Type.Move; break; case "prefix change": type = OperationDescriptor.Type.PrefixChange; break; case "namespace change": type = OperationDescriptor.Type.NamespaceChange; break; default: throw new Exception("Invalid descriptor type."); } OperationDescriptor od = new OperationDescriptor(opid, type); _descriptors[opid] = od; } } }