예제 #1
0
 public void SetNamespaceManager(NamespaceManager nm)
 {
     HttpContext.Current.Session[XML_NAMESPACE_MANAGER] = nm;
 }
예제 #2
0
        private static void UpdateElement(XmlTreeNode updatedNode, NamespaceManager namespaceManager, XmlTreeNode oldNode)
        {
            XElement element = (XElement)oldNode.XObject;

            XmlHelper.ChangeLocalNameForElement(element, updatedNode.Name);

            // If the updated node has been assigned a namespace tag
            if (updatedNode.Tag != null)
            {
                XmlNamespace newNamespace = namespaceManager.GetNamespaceByPrefix(updatedNode.Tag);
                XmlHelper.ChangeNamespace(element, newNamespace);
            }

            // Parents don't have values, because XDocument does not like that
            if (oldNode.IsParrent == false)
                element.Value = updatedNode.Value;
        }
예제 #3
0
 private static void UpdateNamespaceDeclaration(XmlTreeNode updatedNode, NamespaceManager namespaceManager, XDocument doc, XmlTreeNode oldNode)
 {
     XAttribute attribute = (XAttribute)oldNode.XObject;
     namespaceManager.ChangeNamespaceDeclaration(doc, attribute, oldNode.Parrent, updatedNode.Value, updatedNode.Name);
 }
예제 #4
0
        /// <summary>
        /// Used to set the XML data when the user loads an XML file from ether a file or database
        /// </summary>
        /// <param name="doc"></param>
        public void SaveXDocument(XDocument doc)
        {
            // NamespaceManager keeps track of the different namespaces in the curret XML document.
            NamespaceManager nm = new NamespaceManager();
            // Because of this, the NamespaceManager needs to go through the XDocument to scan it for namespace declaration
            nm.CheckXDocumentForNamespaces(doc);

            _dataSource.SetXDocument(doc);
            _dataSource.SetNamespaceManager(nm);
        }