public override void CopyAttributes([NotNull] XmlNode target, [NotNull] IXmlElement patch, [NotNull] XmlPatchNamespaces ns) { Assert.ArgumentNotNull(target, "target"); Assert.ArgumentNotNull(patch, "patch"); Assert.ArgumentNotNull(ns, "ns"); var attributes = patch.GetAttributes().Where(a => a.NamespaceURI != ns.PatchNamespace && (a.NamespaceURI != RoleNamespace || a.LocalName == "define") && a.NamespaceURI != "http://www.w3.org/2000/xmlns/"); var values = attributes.Select(a => ParseXmlNodeInfo(ns, a)).ToArray(); if (!values.Any()) { return; } this.AssignAttributes(target, values); this.AssignSource(target, patch, ns); }
public override void MergeNodes([NotNull] XmlNode target, [NotNull] IXmlElement patch, [NotNull] XmlPatchNamespaces ns) { Assert.ArgumentNotNull(target, "target"); Assert.ArgumentNotNull(patch, "patch"); Assert.ArgumentNotNull(ns, "ns"); if (target.NamespaceURI != patch.NamespaceURI || target.LocalName != patch.LocalName) { return; } var exit = false; foreach (var attribute in patch.GetAttributes()) { if (exit) { continue; } if (attribute.NamespaceURI == RoleNamespace && !RoleConfigurationHelper.ProcessRolesNamespace(attribute)) { // we need to finish enumerating attributes to avoid reader problem exit = true; } } if (exit) { foreach (var node in patch.GetChildren()) { // we need to get children to avoid reader problem } return; } base.MergeNodes(target, patch, ns); }