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(); }
internal abstract void AddMatches(XMLList rv, XMLName name);
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()); } } }
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); } } }
internal virtual void AddDescendants(XMLList rv, XML target) { Rhino.Xmlimpl.XMLName xmlName = this; if (xmlName.IsAttributeName()) { MatchDescendantAttributes(rv, target); } else { MatchDescendantChildren(rv, target); } }
private void AddAttributes(XMLList rv, XML target) { AddMatchingAttributes(rv, target); }
internal virtual XMLList MatchDescendantAttributes(XMLList rv, XML target) { rv.SetTargets(target, null); AddDescendantAttributes(rv, target); return rv; }
internal virtual XMLList MatchDescendantChildren(XMLList rv, XML target) { rv.SetTargets(target, null); AddDescendantChildren(rv, target); return rv; }
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]); } } }
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]); } } } }
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]); } } }
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); }
internal override void AddMatches(XMLList rv, XMLName name) { name.AddMatches(rv, this); }