DevTreks.Data/EditHelpers/XPathIO.cs
/// <summary>
/// Append a child element to the xpathdocument
/// </summary>
/// <param name="insertToNav">navigator holding parent where the child will be appended</param>
/// <param name="parentQry">qry to parent</param>
/// <param name="childElementNav">the child element to append</param>
Append a child element to the xpathdocument
Append a child element to the xpathdocument
public static void AppendChildElement(XPathNavigator insertToNav, string parentQry,
            string prefix, string urn, XPathNavigator childElementNav)
        {
            XPathNavigator oParentElementNav = null;
            if (parentQry.IndexOf(prefix) > 0)
            {
                XmlNamespaceManager oNSManager = new XmlNamespaceManager(insertToNav.NameTable);
                oNSManager.AddNamespace(prefix, urn);
                oParentElementNav = insertToNav.SelectSingleNode(parentQry, oNSManager);
            }
            else
            {
                oParentElementNav = insertToNav.SelectSingleNode(parentQry);
            }
            if (oParentElementNav != null)
            {
                oParentElementNav.AppendChild(childElementNav);
            }
        }
public static void AppendChildElement ( XPathNavigator insertToNav , string parentQry , string prefix , string urn , XPathNavigator childElementNav ) { XPathNavigator oParentElementNav = null ; if ( parentQry . IndexOf ( prefix ) > 0 ) { XmlNamespaceManager oNSManager = new XmlNamespaceManager ( insertToNav . NameTable ) ; oNSManager . AddNamespace ( prefix , urn ) ; oParentElementNav = insertToNav . SelectSingleNode ( parentQry , oNSManager ) ; } else { oParentElementNav = insertToNav . SelectSingleNode ( parentQry ) ; } if ( oParentElementNav != null ) { oParentElementNav . AppendChild ( childElementNav ) ; } }
Append a child element to the xpathdocument
Append a child element to the xpathdocument
insertToNav
XPathNavigator
navigator holding parent where the child will be appended
navigator holding parent where the child will be appended
parentQry
string
qry to parent
qry to parent
prefix
string
urn
string
childElementNav
XPathNavigator
the child element to append
the child element to append