コード例 #1
0
ファイル: XmlNode.cs プロジェクト: hazzik/Rhino.Net
		private static Rhino.Xmlimpl.XmlNode CreateImpl(System.Xml.XmlNode node)
		{
			if (node is XmlDocument)
			{
				throw new ArgumentException();
			}
			Rhino.Xmlimpl.XmlNode rv = null;
			if (GetUserData(node) == null)
			{
				rv = new Rhino.Xmlimpl.XmlNode();
				rv.dom = node;
				SetUserData(node, rv);
			}
			else
			{
				rv = GetUserData(node);
			}
			return rv;
		}
コード例 #2
0
ファイル: XmlNode.cs プロジェクト: hazzik/Rhino.Net
		internal virtual Rhino.Xmlimpl.XmlNode[] GetAttributes()
		{
			XmlNamedNodeMap attrs = this.dom.Attributes;
			//    TODO    Or could make callers handle null?
			if (attrs == null)
			{
				throw new InvalidOperationException("Must be element.");
			}
			Rhino.Xmlimpl.XmlNode[] rv = new Rhino.Xmlimpl.XmlNode[attrs.Count];
			for (int i = 0; i < attrs.Count; i++)
			{
				rv[i] = CreateImpl(attrs.Item(i));
			}
			return rv;
		}
コード例 #3
0
ファイル: XML.cs プロジェクト: hazzik/Rhino.Net
		//
		//    Methods relating to modification of child nodes
		//
		//    We create all the nodes we are inserting before doing the insert to
		//    avoid nasty cycles caused by mutability of these objects.  For example,
		//    what if the toString() method of value modifies the XML object we were
		//    going to insert into?  insertAfter might get confused about where to
		//    insert.  This actually came up with SpiderMonkey, leading to a (very)
		//    long discussion.  See bug #354145.
		private Rhino.Xmlimpl.XmlNode[] GetNodesForInsert(object value)
		{
			if (value is Rhino.Xmlimpl.XML)
			{
				return new Rhino.Xmlimpl.XmlNode[] { ((Rhino.Xmlimpl.XML)value).node };
			}
			else
			{
				if (value is XMLList)
				{
					XMLList list = (XMLList)value;
					Rhino.Xmlimpl.XmlNode[] rv = new Rhino.Xmlimpl.XmlNode[list.Length()];
					for (int i = 0; i < list.Length(); i++)
					{
						rv[i] = list.Item(i).node;
					}
					return rv;
				}
				else
				{
					return new Rhino.Xmlimpl.XmlNode[] { Rhino.Xmlimpl.XmlNode.CreateText(GetProcessor(), ScriptRuntime.ToString(value)) };
				}
			}
		}
コード例 #4
0
ファイル: XML.cs プロジェクト: hazzik/Rhino.Net
		internal virtual void Initialize(Rhino.Xmlimpl.XmlNode node)
		{
			this.node = node;
			this.node.SetXml(this);
		}