Inheritance: XMLObjectImpl, Function
Ejemplo n.º 1
0
		internal void InitAsDotQuery()
		{
			XMLObject prototype = (XMLObject)GetPrototype();
			// XMLWithScope also handles the .(xxx) DotQuery for XML
			// basically DotQuery is a for/in/with statement and in
			// the following 3 statements we setup to signal it's
			// DotQuery,
			// the index and the object being looped over.  The
			// xws.setPrototype is the scope of the object which is
			// is a element of the lhs (XMLList).
			_currIndex = 0;
			_dqPrototype = prototype;
			if (prototype is XMLList)
			{
				XMLList xl = (XMLList)prototype;
				if (xl.Length() > 0)
				{
					SetPrototype((Scriptable)(xl.Get(0, null)));
				}
			}
			// Always return the outer-most type of XML lValue of
			// XML to left of dotQuery.
			_xmlList = lib.NewXMLList();
		}
Ejemplo n.º 2
0
		internal abstract void AddMatches(XMLList rv, XMLName name);
Ejemplo n.º 3
0
		internal virtual void AddMatches(XMLList rv, XML target)
		{
			if (IsDescendants())
			{
				AddDescendants(rv, target);
			}
			else
			{
				if (IsAttributeName())
				{
					AddAttributes(rv, target);
				}
				else
				{
					XML[] children = target.GetChildren();
					if (children != null)
					{
						for (int i = 0; i < children.Length; i++)
						{
							if (this.Matches(children[i]))
							{
								rv.AddToList(children[i]);
							}
						}
					}
					rv.SetTargets(target, this.ToQname());
				}
			}
		}
Ejemplo n.º 4
0
		internal virtual void AddMatchingChildren(XMLList result, Rhino.Xmlimpl.XmlNode.Filter filter)
		{
			System.Xml.XmlNode node = this.dom;
			XmlNodeList children = node.ChildNodes;
			for (int i = 0; i < children.Count; i++)
			{
				System.Xml.XmlNode childnode = children.Item(i);
				Rhino.Xmlimpl.XmlNode child = Rhino.Xmlimpl.XmlNode.CreateImpl(childnode);
				if (filter.Accept(childnode))
				{
					result.AddToList(child);
				}
			}
		}
Ejemplo n.º 5
0
		internal virtual void AddDescendants(XMLList rv, XML target)
		{
			Rhino.Xmlimpl.XMLName xmlName = this;
			if (xmlName.IsAttributeName())
			{
				MatchDescendantAttributes(rv, target);
			}
			else
			{
				MatchDescendantChildren(rv, target);
			}
		}
Ejemplo n.º 6
0
		private void AddAttributes(XMLList rv, XML target)
		{
			AddMatchingAttributes(rv, target);
		}
Ejemplo n.º 7
0
		internal virtual XMLList MatchDescendantAttributes(XMLList rv, XML target)
		{
			rv.SetTargets(target, null);
			AddDescendantAttributes(rv, target);
			return rv;
		}
Ejemplo n.º 8
0
		internal virtual XMLList MatchDescendantChildren(XMLList rv, XML target)
		{
			rv.SetTargets(target, null);
			AddDescendantChildren(rv, target);
			return rv;
		}
Ejemplo n.º 9
0
		private void AddDescendantAttributes(XMLList list, XML target)
		{
			if (target.IsElement())
			{
				AddMatchingAttributes(list, target);
				XML[] children = target.GetChildren();
				for (int i = 0; i < children.Length; i++)
				{
					AddDescendantAttributes(list, children[i]);
				}
			}
		}
Ejemplo n.º 10
0
		internal virtual void AddMatchingAttributes(XMLList list, XML target)
		{
			Rhino.Xmlimpl.XMLName name = this;
			if (target.IsElement())
			{
				XML[] attributes = target.GetAttributes();
				for (int i = 0; i < attributes.Length; i++)
				{
					if (name.Matches(attributes[i]))
					{
						list.AddToList(attributes[i]);
					}
				}
			}
		}
Ejemplo n.º 11
0
		private void AddDescendantChildren(XMLList list, XML target)
		{
			Rhino.Xmlimpl.XMLName xmlName = this;
			if (target.IsElement())
			{
				XML[] children = target.GetChildren();
				for (int i = 0; i < children.Length; i++)
				{
					if (xmlName.Matches(children[i]))
					{
						list.AddToList(children[i]);
					}
					AddDescendantChildren(list, children[i]);
				}
			}
		}
Ejemplo n.º 12
0
		private void ExportToScope(bool @sealed)
		{
			xmlPrototype = NewXML(Rhino.Xmlimpl.XmlNode.CreateText(options, string.Empty));
			xmlListPrototype = NewXMLList();
			namespacePrototype = Namespace.Create(this.globalScope, null, Rhino.Xmlimpl.XmlNode.Namespace.GLOBAL);
			qnamePrototype = QName.Create(this, this.globalScope, null, Rhino.Xmlimpl.XmlNode.QName.Create(Rhino.Xmlimpl.XmlNode.Namespace.Create(string.Empty), string.Empty));
			xmlPrototype.ExportAsJSClass(@sealed);
			xmlListPrototype.ExportAsJSClass(@sealed);
			namespacePrototype.ExportAsJSClass(@sealed);
			qnamePrototype.ExportAsJSClass(@sealed);
		}
Ejemplo n.º 13
0
		internal override void AddMatches(XMLList rv, XMLName name)
		{
			name.AddMatches(rv, this);
		}