/// <summary>
        ///     Combines to xml documents into one.
        /// </summary>
        /// <param name="XmlDoc">XmlDoc you want to add to this Xmldoc</param>
        /// <param name="xPathFrom">XPath to the node or nodes you want to move</param>
        /// <param name="xPathTo">XPath to the node that you want to place the xml</param>
        /// <returns></returns>
        public AuroraXmlDocument AddXMLDoc(AuroraXmlDocument XmlDoc, string xPathFrom, string xPathTo)
        {
            if (DocumentElement == null)
            {
                throw new Exception("DocumentElemnt is null");
            }
            XmlNode node = XmlDoc.SelectSingleNode(xPathFrom);

            if (node != null)
            {
                if (node.ParentNode != null)
                {
                    XmlNode selectedNode  = node.ParentNode.RemoveChild(node);
                    XmlNode selectedNode2 = ImportNode(selectedNode, true);
                    XmlNode singleNode    = DocumentElement.SelectSingleNode(xPathTo);
                    if (singleNode != null)
                    {
                        singleNode.AppendChild(selectedNode2);
                    }
                }
            }
            return(this);
        }
示例#2
0
 /// <summary>
 ///     Combines to xml documents into one.
 /// </summary>
 /// <param name="XmlDoc">XmlDoc you want to add to this Xmldoc</param>
 /// <param name="xPathFrom">XPath to the node or nodes you want to move</param>
 /// <param name="xPathTo">XPath to the node that you want to place the xml</param>
 /// <returns></returns>
 public AuroraXmlDocument AddXMLDoc(AuroraXmlDocument XmlDoc, string xPathFrom, string xPathTo)
 {
     if (DocumentElement == null) throw new Exception("DocumentElemnt is null");
     XmlNode node = XmlDoc.SelectSingleNode(xPathFrom);
     if (node != null)
     {
         if (node.ParentNode != null)
         {
             XmlNode selectedNode = node.ParentNode.RemoveChild(node);
             XmlNode selectedNode2 = ImportNode(selectedNode, true);
             XmlNode singleNode = DocumentElement.SelectSingleNode(xPathTo);
             if (singleNode != null)
                 singleNode.AppendChild(selectedNode2);
         }
     }
     return this;
 }