Example #1
0
 public string this[string name]
 {
     get
     {
         return(CommonXml.GetAttributeValue(m_XmlNode, name));
     }
     set
     {
         CommonXml.SetAttributeValue(m_XmlNode, name, value);
     }
 }
Example #2
0
        private static void doMergeXml(XmlNode baseXmlNode, XmlNode mergeXmlNode, params string[] uniqueIdentifiers)
        {
            foreach (XmlNode xmlNode in mergeXmlNode)
            {
                if (xmlNode.Name != "#text")
                {
                    EmptyNodeHandling emptyNode;
                    if (Common.StringArrayContains(uniqueIdentifiers, xmlNode.Name))
                    {
                        emptyNode = EmptyNodeHandling.ForceCreateNew;
                    }
                    else
                    {
                        emptyNode = EmptyNodeHandling.CreateNew;
                    }

                    XmlNode currentBaseXmlnode = GetNode(baseXmlNode, xmlNode.Name, emptyNode);
                    foreach (XmlAttribute xmlAttribute in xmlNode.Attributes)
                    {
                        CommonXml.SetAttributeValue(currentBaseXmlnode, xmlAttribute.Name, xmlAttribute.Value);
                    }
                    if (xmlNode.HasChildNodes)
                    {
                        doMergeXml(currentBaseXmlnode, xmlNode, uniqueIdentifiers);
                    }
                }
                else
                {
                    XmlNode textNode = baseXmlNode.SelectSingleNode("text()");
                    if (textNode != null)
                    {
                        textNode.InnerText = xmlNode.Value;
                    }
                    else
                    {
                        baseXmlNode.AppendChild(baseXmlNode.OwnerDocument.CreateTextNode(xmlNode.Value));
                    }
                }
            }
        }