Sage.Tools.Utilities.ExtensionBuilder.CopyConfiguration C# (CSharp) Method

CopyConfiguration() private static method

private static CopyConfiguration ( PackageGroup group, string parentName, string childName, XmlElement source, XmlElement target ) : void
group Sage.Extensibility.PackageGroup
parentName string
childName string
source System.Xml.XmlElement
target System.Xml.XmlElement
return void
        private static void CopyConfiguration(PackageGroup group, string parentName, string childName, XmlElement source, XmlElement target)
        {
            string aggregateXpath = string.Format("{0}/{1}/@name", parentName, childName);
            List<string> names = group.FilterNames(source.Aggregate(aggregateXpath, XmlNamespaces.Manager));
            if (names.Count != 0)
            {
                XmlNode parentNode = target.AppendElement(parentName.Replace("p:", string.Empty), XmlNamespaces.ProjectConfigurationNamespace);
                foreach (string name in names)
                {
                    string xpath = string.Format("{0}/{1}[@name='{2}']", parentName, childName, name);
                    parentNode.AppendChild(target.OwnerDocument.ImportNode(
                        source.SelectSingleNode(xpath, XmlNamespaces.Manager), true));
                }
            }
        }