예제 #1
0
		public void Save(string filename, Node node)
		{
			FinalizeRootElement(node);
			Node.InternalAdjustPrefix(node.domNode, true);
			node.AdjustPrefix();
			node.domNode.OwnerDocument.Save(filename);
		}
예제 #2
0
        protected void FinalizeRootElement(Node node)
        {
            if (node.domNode.ParentNode.NodeType != XmlNodeType.DocumentFragment)
                return;

            if (rootElementName == null || rootElementName == "")
                throw new Exception("Call SetRootElementName first");

            node.MakeRoot(namespaceURI, rootElementName, schemaLocation);
            DeclareNamespaces(node);
        }
예제 #3
0
 protected abstract void DeclareNamespaces(Node node);
예제 #4
0
 protected void DeclareNamespace(Node node, string prefix, string URI)
 {
     node.DeclareNamespace(prefix, URI);
 }
예제 #5
0
 public void Save(string filename, Node node)
 {
     FinalizeRootElement(node);
     node.domNode.OwnerDocument.Save(filename);
 }
예제 #6
0
 public Node(Node node)
 {
     domNode = node.domNode;
 }
예제 #7
0
 protected XmlNode ReplaceDomElementAt(string URI, string name, int index, Node node)
 {
     node.domNode = CloneDomElementAs(URI, name, node);
     return domNode.ReplaceChild(node.domNode, GetDomChildAt(NodeType.Element, URI, name, index));
 }
예제 #8
0
 protected XmlNode InsertDomElementAt(string URI, string name, int index, Node node)
 {
     node.domNode = CloneDomElementAs(URI, name, node);
     return domNode.InsertBefore(node.domNode, GetDomChildAt(NodeType.Element, URI, name, index));
 }
예제 #9
0
        protected XmlElement CloneDomElementAs(string URI, string name, Node node)
        {
            XmlElement srcElement = (XmlElement)node.domNode;
            XmlElement dstElement = domNode.OwnerDocument.CreateElement(name, URI);
            XmlDocument doc = domNode.OwnerDocument;

            foreach (XmlAttribute attribute in srcElement.Attributes)
                dstElement.Attributes.Append((XmlAttribute)doc.ImportNode(attribute, false));
            foreach (XmlNode childNode in srcElement.ChildNodes)
                dstElement.AppendChild(doc.ImportNode(childNode, true));
            return dstElement;
        }
예제 #10
0
 protected XmlNode AppendDomElement(string URI, string name, Node node)
 {
     node.domNode = CloneDomElementAs(URI, name, node);
     return domNode.AppendChild(node.domNode);
 }