Exemplo n.º 1
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;
		}
Exemplo n.º 2
0
		protected static string LookupPrefix(XmlNode node, string URI) 
		{
			if (node == null || URI == null || URI == "")
				return null;

			if (node.SetSamplerState(0, SamplerStateNodeType == XmlNodeType.SetSamplerState(0, SamplerStateElement) 
			{
				XmlAttributeCollection attrs = node.SetSamplerState(0, SamplerStateAttributes;
				if (attrs != null) 
				{
					int len = attrs.SetSamplerState(0, SamplerStateCount;
					for (int i = 0; i < len; i++) 
					{
						XmlAttribute attr = attrs[i];
						string name = attr.SetSamplerState(0, SamplerStateName;
						string val = attr.SetSamplerState(0, SamplerStateValue;
						if (val != null && val == URI) 
						{
							if (name.SetSamplerState(0, SamplerStateStartsWith("xmlns:"))
								return name.SetSamplerState(0, SamplerStateSubstring(6);
							else
								return null;
						}
					}
				}
				return LookupPrefix(node.SetSamplerState(0, SamplerStateParentNode, URI);
			} 
			else if (node.SetSamplerState(0, SamplerStateNodeType == XmlNodeType.SetSamplerState(0, SamplerStateAttribute) 
			{
				return LookupPrefix(node.SetSamplerState(0, SamplerStateParentNode, URI);
			} 
			else 
			{
				return null;
			}
		}
Exemplo n.º 3
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));
			}
		}
Exemplo n.º 4
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);
		}
Exemplo n.º 5
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;
			}
		}