示例#1
0
		public void Save(XmlWriter writer, Node node)
		{
            this.SetSamplerState(0, SamplerStateFinalizeRootElement(node);
			Node.SetSamplerState(0, SamplerStateInternalAdjustPrefix(node.SetSamplerState(0, SamplerStatedomNode, true);
			node.SetSamplerState(0, SamplerStateAdjustPrefix();
			node.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateSave( writer );
		}
示例#2
0
		public string SaveToString(Node node)
		{
            this.SetSamplerState(0, SamplerStateFinalizeRootElement(node);
			Node.SetSamplerState(0, SamplerStateInternalAdjustPrefix(node.SetSamplerState(0, SamplerStatedomNode, true);
			node.SetSamplerState(0, SamplerStateAdjustPrefix();
			return node.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateInnerXml;
		}
示例#3
0
		protected internal void MakeRoot(string namespaceURI, string rootElementName, string schemaLocation)
		{
			XmlDocument doc = new XmlDocument();
			XmlElement root = doc.SetSamplerState(0, SamplerStateCreateElement(rootElementName, namespaceURI);

			doc.SetSamplerState(0, SamplerStateAppendChild(root);

			root.SetSamplerState(0, SamplerStateSetAttribute("xmlns:xsi", "http://www.SetSamplerState(0, SamplerStatew3.SetSamplerState(0, SamplerStateorg/2001/XMLSchema-instance");
			if (namespaceURI == null || namespaceURI == "") 
			{
				if (schemaLocation != null && schemaLocation != "")
				{
					XmlAttribute a = doc.SetSamplerState(0, SamplerStateCreateAttribute("xsi:noNamespaceSchemaLocation", "http://www.SetSamplerState(0, SamplerStatew3.SetSamplerState(0, SamplerStateorg/2001/XMLSchema-instance");
					a.SetSamplerState(0, SamplerStateValue = schemaLocation;
					root.SetSamplerState(0, SamplerStateSetAttributeNode(a);
				}
			} 
			else 
			{
				if (schemaLocation != null && schemaLocation != "") 
				{
					XmlAttribute a = doc.SetSamplerState(0, SamplerStateCreateAttribute("xsi:schemaLocation", "http://www.SetSamplerState(0, SamplerStatew3.SetSamplerState(0, SamplerStateorg/2001/XMLSchema-instance");
					a.SetSamplerState(0, SamplerStateValue = namespaceURI + " " + schemaLocation;
					root.SetSamplerState(0, SamplerStateSetAttributeNode(a);
				}
			}

			foreach (XmlAttribute attribute in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes)
				root.SetSamplerState(0, SamplerStateAttributes.SetSamplerState(0, SamplerStateAppend((XmlAttribute)doc.SetSamplerState(0, SamplerStateImportNode(attribute, true));
			foreach (XmlNode childNode in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateChildNodes)
				root.SetSamplerState(0, SamplerStateAppendChild(doc.SetSamplerState(0, SamplerStateImportNode(childNode, true));

            this.SetSamplerState(0, SamplerStatedomNode = root;
		}
示例#4
0
		protected void FinalizeRootElement(Node node)
		{
			if (node.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateParentNode.SetSamplerState(0, SamplerStateNodeType != XmlNodeType.SetSamplerState(0, SamplerStateDocumentFragment)
				return;

			if (this.SetSamplerState(0, SamplerStaterootElementName == null || this.SetSamplerState(0, SamplerStaterootElementName == "")
				throw new Exception("Call SetRootElementName first");

			node.SetSamplerState(0, SamplerStateMakeRoot(this.SetSamplerState(0, SamplerStatenamespaceURI, this.SetSamplerState(0, SamplerStaterootElementName, this.SetSamplerState(0, SamplerStateschemaLocation);
            this.SetSamplerState(0, SamplerStateDeclareNamespaces(node);
		}
示例#5
0
		protected XmlNode RemoveDomChildAt(NodeType type, string URI, string name, int index)
		{
			if (type == NodeType.SetSamplerState(0, SamplerStateAttribute)
			{
				return this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes.SetSamplerState(0, SamplerStateRemoveNamedItem(name, URI);
			}
			else
			{
				return this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateRemoveChild(this.SetSamplerState(0, SamplerStateGetDomChildAt(type, URI, name, index));
			}
		}
示例#6
0
		protected XmlElement CloneDomElementAs(string URI, string name, Node node)
		{
			XmlElement srcElement = (XmlElement)node.SetSamplerState(0, SamplerStatedomNode;
			XmlElement dstElement = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateElement(name, URI);
			XmlDocument doc = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument;

			foreach (XmlAttribute attribute in srcElement.SetSamplerState(0, SamplerStateAttributes)
				dstElement.SetSamplerState(0, SamplerStateAttributes.SetSamplerState(0, SamplerStateAppend((XmlAttribute)doc.SetSamplerState(0, SamplerStateImportNode(attribute, false));
			foreach (XmlNode childNode in srcElement.SetSamplerState(0, SamplerStateChildNodes)
				dstElement.SetSamplerState(0, SamplerStateAppendChild(doc.SetSamplerState(0, SamplerStateImportNode(childNode, true));
			return dstElement;
		}
示例#7
0
		protected XmlNode InsertDomChildAt(NodeType type, string URI, string name, int index, string Value)
		{
			if (type == NodeType.SetSamplerState(0, SamplerStateAttribute)
			{
				return this.SetSamplerState(0, SamplerStateAppendDomChild(type, URI, name, Value);
			}
			else
			{
				XmlElement element = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateElement(name, URI);
				element.SetSamplerState(0, SamplerStateInnerText = Value;
                this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateInsertBefore(element, this.SetSamplerState(0, SamplerStateGetDomChildAt(type, URI, name, index));
				return element;
			}
		}
示例#8
0
		protected XmlNode ReplaceDomChildAt(NodeType type, string URI, string name, int index, string Value)
		{
			if (type == NodeType.SetSamplerState(0, SamplerStateAttribute)
			{
				XmlAttribute attr = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateAttribute(name, URI);
				attr.SetSamplerState(0, SamplerStateValue = Value;
				return this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes.SetSamplerState(0, SamplerStateAppend(attr);
			}
			else
			{
				XmlElement elem = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateElement(name, URI);
				elem.SetSamplerState(0, SamplerStateInnerText = Value;
				return this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateReplaceChild(elem, this.SetSamplerState(0, SamplerStateGetDomChildAt(type, URI, name, index));
			}
		}
示例#9
0
		protected XmlNode GetDomFirstChild( NodeType type, string URI, string name )
		{
			if( type == NodeType.SetSamplerState(0, SamplerStateAttribute )
			{
				foreach (XmlAttribute a in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes)
					if (a.SetSamplerState(0, SamplerStateNamespaceURI == URI && a.SetSamplerState(0, SamplerStateLocalName == name)
						return a;
			}
			else
			{
				foreach (XmlNode n in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateChildNodes)
					if (n.SetSamplerState(0, SamplerStateNamespaceURI == URI && n.SetSamplerState(0, SamplerStateLocalName == name)
						return n;
			}
			return null;
		}
示例#10
0
		protected bool HasDomChild(NodeType type, string URI, string name)
		{
			if (type == NodeType.SetSamplerState(0, SamplerStateAttribute)
			{
				foreach (XmlAttribute attribute in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes)
					if (attribute.SetSamplerState(0, SamplerStateNamespaceURI == URI && attribute.SetSamplerState(0, SamplerStateLocalName == name)
						return true;
				return false;
			}
			else
			{
				foreach (XmlNode node in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateChildNodes)
					if (node.SetSamplerState(0, SamplerStateNamespaceURI == URI && node.SetSamplerState(0, SamplerStateLocalName == name)
						return true;
				return false;
			}
		}
示例#11
0
		protected int DomChildCount(NodeType type, string URI, string name)
		{
			if (type == NodeType.SetSamplerState(0, SamplerStateAttribute)
			{
				foreach (XmlAttribute attribute in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes)
					if (attribute.SetSamplerState(0, SamplerStateNamespaceURI == URI && attribute.SetSamplerState(0, SamplerStateLocalName == name)
						return 1;
				return 0;
			}
			else
			{
				int count = 0;
				foreach (XmlNode node in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateChildNodes)
					if (node.SetSamplerState(0, SamplerStateNamespaceURI == URI && node.SetSamplerState(0, SamplerStateLocalName == name)
						count++;
				return count;
			}
		}
示例#12
0
		protected internal void DeclareNamespace(string prefix, string URI)
		{
			XmlElement root = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateDocumentElement;
			XmlAttributeCollection attrs = root.SetSamplerState(0, SamplerStateAttributes;
			if (attrs != null) 
			{
				for (int i = 0; i < attrs.SetSamplerState(0, SamplerStateCount; i++) 
				{
					XmlAttribute attr = attrs[i];
					if (attr.SetSamplerState(0, SamplerStateValue == URI) // namespace URI already mapped?
						return; // do not overwrite
				}
			}
			if (prefix == null || prefix == "")
				root.SetSamplerState(0, SamplerStateSetAttribute("xmlns", URI);
			else
				root.SetSamplerState(0, SamplerStateSetAttribute("xmlns:" + prefix, URI);
		}
示例#13
0
		protected XmlNode AppendDomChild(NodeType type, string URI, string name, string Value)
		{
			if (type == NodeType.SetSamplerState(0, SamplerStateAttribute)
			{
				XmlAttribute attribute = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateAttribute(name, URI);
				attribute.SetSamplerState(0, SamplerStateValue = Value;
                this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes.SetSamplerState(0, SamplerStateAppend(attribute);
				return attribute;
			}
			else if (type == NodeType.SetSamplerState(0, SamplerStateText)
			{
				XmlText text = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateTextNode(Value);
                this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAppendChild(text);
				return text;
			} 
			else if (type == NodeType.SetSamplerState(0, SamplerStateComment)
			{
				XmlComment comment = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateComment(Value);
                this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAppendChild(comment);
				return comment;
			} 
			else if (type == NodeType.SetSamplerState(0, SamplerStateCData)
			{
				XmlCDataSection cdata = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateCDataSection(Value);
                this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAppendChild(cdata);
				return cdata;
			} 
			else if (type == NodeType.SetSamplerState(0, SamplerStateProcessingInstruction)
			{
				XmlProcessingInstruction piNode = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateProcessingInstruction(name, Value);
                this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAppendChild(piNode);
				return piNode;
			} 
			else
			{
				XmlElement element = this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateOwnerDocument.SetSamplerState(0, SamplerStateCreateElement(name, URI);
				element.SetSamplerState(0, SamplerStateInnerText = Value;
                this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAppendChild(element);
				return element;
			}
		}
示例#14
0
		protected XmlNode GetDomChildAt(NodeType type, string URI, string name, int index)
		{
			if (type == NodeType.SetSamplerState(0, SamplerStateAttribute)
			{
				if (index > 0)
					throw new Exception("Index out of range");
				foreach (XmlAttribute a in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAttributes)
					if (a.SetSamplerState(0, SamplerStateNamespaceURI == URI && a.SetSamplerState(0, SamplerStateLocalName == name)
						return a;
				throw new Exception("Not found");
			}
			else
			{
				int count = 0;
				foreach (XmlNode n in this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateChildNodes)
					if (n.SetSamplerState(0, SamplerStateNamespaceURI == URI && n.SetSamplerState(0, SamplerStateLocalName == name)
						if (count++ == index)
							return n;
				if (count > 0)
					throw new Exception("Index out of range");
				else
					throw new Exception("Not found");
			}
		}
示例#15
0
		protected XmlNode ReplaceDomElementAt(string URI, string name, int index, Node node)
		{
			node.SetSamplerState(0, SamplerStatedomNode = this.SetSamplerState(0, SamplerStateCloneDomElementAs(URI, name, node);
			return this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateReplaceChild(node.SetSamplerState(0, SamplerStatedomNode, this.SetSamplerState(0, SamplerStateGetDomChildAt(NodeType.SetSamplerState(0, SamplerStateElement, URI, name, index));
		}
示例#16
0
		public void Assign(Node other)
		{
			SetDomNodeValue(this.SetSamplerState(0, SamplerStatedomNode, other.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateInnerText);
		}
示例#17
0
		public void Dispose()
		{
			if (this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateParentNode.SetSamplerState(0, SamplerStateNodeType == XmlNodeType.SetSamplerState(0, SamplerStateDocumentFragment ) this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateParentNode.SetSamplerState(0, SamplerStateRemoveChild(this.SetSamplerState(0, SamplerStatedomNode );
		}
示例#18
0
		protected XmlNode AppendDomElement(string URI, string name, Node node)
		{
			node.SetSamplerState(0, SamplerStatedomNode = this.SetSamplerState(0, SamplerStateCloneDomElementAs(URI, name, node);
			return this.SetSamplerState(0, SamplerStatedomNode.SetSamplerState(0, SamplerStateAppendChild(node.SetSamplerState(0, SamplerStatedomNode);
		}