Inheritance: Rhino.Ref
Example #1
0
		internal virtual Rhino.Xmlimpl.XML MakeXmlFromString(XMLName name, string value)
		{
			try
			{
				return NewTextElementXML(this.node, name.ToQname(), value);
			}
			catch (Exception e)
			{
				throw ScriptRuntime.TypeError(e.Message);
			}
		}
Example #2
0
		//
		//    Methods from XMLObjectImpl
		//
		internal override bool HasXMLProperty(XMLName xmlName)
		{
			return (GetPropertyList(xmlName).Length() > 0);
		}
Example #3
0
		internal abstract bool HasOwnProperty(XMLName xmlName);
Example #4
0
		internal abstract XMLList Child(XMLName xmlName);
Example #5
0
		internal abstract void AddMatches(XMLList rv, XMLName name);
Example #6
0
		/// <summary>
		/// ecmaPut(cx, id, value) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </summary>
		/// <remarks>
		/// ecmaPut(cx, id, value) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </remarks>
		internal abstract void PutXMLProperty(XMLName name, object value);
Example #7
0
		/// <summary>
		/// ecmaHas(cx, id) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </summary>
		/// <remarks>
		/// ecmaHas(cx, id) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </remarks>
		internal abstract bool HasXMLProperty(XMLName name);
Example #8
0
			internal static Rhino.Xmlimpl.XmlNode.Filter PROCESSING_INSTRUCTION(XMLName name)
			{
				return new _Filter_852(name);
			}
Example #9
0
		internal override void AddMatches(XMLList rv, XMLName name)
		{
			name.AddMatches(rv, this);
		}
Example #10
0
		internal virtual void SetAttribute(XMLName xmlName, object value)
		{
			if (!IsElement())
			{
				throw new InvalidOperationException("Can only set attributes on elements.");
			}
			//    TODO    Is this legal, but just not "supported"?  If so, support it.
			if (xmlName.Uri() == null && xmlName.LocalName().Equals("*"))
			{
				throw ScriptRuntime.TypeError("@* assignment not supported.");
			}
			this.node.SetAttribute(xmlName.ToQname(), ScriptRuntime.ToString(value));
		}
Example #11
0
		internal override bool HasOwnProperty(XMLName xmlName)
		{
			bool hasProperty = false;
			if (IsPrototype())
			{
				string property = xmlName.LocalName();
				hasProperty = (0 != FindPrototypeId(property));
			}
			else
			{
				hasProperty = (GetPropertyList(xmlName).Length() > 0);
			}
			return hasProperty;
		}
Example #12
0
		internal override void PutXMLProperty(XMLName xmlName, object value)
		{
			if (IsPrototype())
			{
			}
			else
			{
				//    TODO    Is this really a no-op?  Check the spec to be sure
				xmlName.SetMyValueOn(this, value);
			}
		}
Example #13
0
		internal override void DeleteXMLProperty(XMLName name)
		{
			XMLList list = GetPropertyList(name);
			for (int i = 0; i < list.Length(); i++)
			{
				list.Item(i).node.DeleteMe();
			}
		}
Example #14
0
		//    Used only by XML, XMLList
		internal virtual XMLList GetPropertyList(XMLName name)
		{
			return name.GetMyValueOn(this);
		}
Example #15
0
		internal override object GetXMLProperty(XMLName xmlName)
		{
			return GetPropertyList(xmlName);
		}
Example #16
0
		internal static Rhino.Xmlimpl.XMLName FormProperty(Rhino.Xmlimpl.XmlNode.Namespace @namespace, string localName)
		{
			if (localName != null && localName.Equals("*"))
			{
				localName = null;
			}
			Rhino.Xmlimpl.XMLName rv = new Rhino.Xmlimpl.XMLName();
			rv.qname = Rhino.Xmlimpl.XmlNode.QName.Create(@namespace, localName);
			return rv;
		}
Example #17
0
		internal static Rhino.Xmlimpl.XMLName Create(Rhino.Xmlimpl.XmlNode.QName qname, bool attribute, bool descendants)
		{
			Rhino.Xmlimpl.XMLName rv = new Rhino.Xmlimpl.XMLName();
			rv.qname = qname;
			rv.isAttributeName = attribute;
			rv.isDescendants = descendants;
			return rv;
		}
Example #18
0
		internal override XMLList Elements(XMLName name)
		{
			XMLList rv = NewXMLList();
			rv.SetTargets(this, name.ToQname());
			//    TODO    Should have an XMLNode.Filter implementation based on XMLName
			Rhino.Xmlimpl.XmlNode[] elements = this.node.GetMatchingChildren(Rhino.Xmlimpl.XmlNode.Filter.ELEMENT);
			for (int i = 0; i < elements.Length; i++)
			{
				if (name.Matches(ToXML(elements[i])))
				{
					rv.AddToList(ToXML(elements[i]));
				}
			}
			return rv;
		}
Example #19
0
				public _Filter_852(XMLName name)
				{
					this.name = name;
				}
Example #20
0
		internal override XMLList Child(XMLName xmlName)
		{
			//    TODO    Right now I think this method would allow child( "@xxx" ) to return the xxx attribute, which is wrong
			XMLList rv = NewXMLList();
			//    TODO    Should this also match processing instructions?  If so, we have to change the filter and also the XMLName
			//            class to add an acceptsProcessingInstruction() method
			Rhino.Xmlimpl.XmlNode[] elements = this.node.GetMatchingChildren(Rhino.Xmlimpl.XmlNode.Filter.ELEMENT);
			for (int i = 0; i < elements.Length; i++)
			{
				if (xmlName.MatchesElement(elements[i].GetQname()))
				{
					rv.AddToList(ToXML(elements[i]));
				}
			}
			rv.SetTargets(this, xmlName.ToQname());
			return rv;
		}
Example #21
0
		/// <summary>
		/// ecmaGet(cx, id) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </summary>
		/// <remarks>
		/// ecmaGet(cx, id) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </remarks>
		internal abstract object GetXMLProperty(XMLName name);
Example #22
0
		internal virtual Rhino.Xmlimpl.XML Replace(XMLName xmlName, object xml)
		{
			PutXMLProperty(xmlName, xml);
			return this;
		}
Example #23
0
		/// <summary>
		/// ecmaDelete(cx, id) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </summary>
		/// <remarks>
		/// ecmaDelete(cx, id) calls this after resolving when id to XMLName
		/// and checking it is not Uint32 index.
		/// </remarks>
		internal abstract void DeleteXMLProperty(XMLName name);
Example #24
0
		internal override XMLList ProcessingInstructions(XMLName xmlName)
		{
			XMLList rv = NewXMLList();
			this.node.AddMatchingChildren(rv, Rhino.Xmlimpl.XmlNode.Filter.PROCESSING_INSTRUCTION(xmlName));
			return rv;
		}
Example #25
0
		private XMLList GetMatches(XMLName name)
		{
			XMLList rv = NewXMLList();
			AddMatches(rv, name);
			return rv;
		}
Example #26
0
		private Ref XmlPrimaryReference(Context cx, XMLName xmlName, Scriptable scope)
		{
			XMLObjectImpl xmlObj;
			XMLObjectImpl firstXml = null;
			for (; ; )
			{
				// XML object can only present on scope chain as a wrapper
				// of XMLWithScope
				if (scope is XMLWithScope)
				{
					xmlObj = (XMLObjectImpl)scope.GetPrototype();
					if (xmlObj.HasXMLProperty(xmlName))
					{
						break;
					}
					if (firstXml == null)
					{
						firstXml = xmlObj;
					}
				}
				scope = scope.GetParentScope();
				if (scope == null)
				{
					xmlObj = firstXml;
					break;
				}
			}
			// xmlObj == null corresponds to undefined as the target of
			// the reference
			if (xmlObj != null)
			{
				xmlName.InitXMLObject(xmlObj);
			}
			return xmlName;
		}
Example #27
0
		internal abstract XMLList Elements(XMLName xmlName);
Example #28
0
		internal static Rhino.Xmlimpl.XMLName FormStar()
		{
			Rhino.Xmlimpl.XMLName rv = new Rhino.Xmlimpl.XMLName();
			rv.qname = Rhino.Xmlimpl.XmlNode.QName.Create(null, null);
			return rv;
		}
Example #29
0
		internal abstract XMLList ProcessingInstructions(XMLName xmlName);
Example #30
0
		private Rhino.Xmlimpl.XMLList GetPropertyList(XMLName name)
		{
			Rhino.Xmlimpl.XMLList propertyList = NewXMLList();
			Rhino.Xmlimpl.XmlNode.QName qname = null;
			if (!name.IsDescendants() && !name.IsAttributeName())
			{
				// Only set the targetProperty if this is a regular child get
				// and not a descendant or attribute get
				qname = name.ToQname();
			}
			propertyList.SetTargets(this, qname);
			for (int i = 0; i < Length(); i++)
			{
				propertyList.AddToList(GetXmlFromAnnotation(i).GetPropertyList(name));
			}
			return propertyList;
		}