private object Copy() { XMLList list = new XMLList(lib); foreach (XML xml in m_Nodes) { list.Add((XML)xml.Copy()); } return(list); }
/// <summary> /// XML.prototype.children ( ) /// /// The children method returns an XMLList containing all the /// properties of this XML object in order. /// /// See ECMA 13.4.4.8 /// </summary> internal XMLList Children() { XMLList list = new XMLList (lib); foreach (XmlNode node in UnderlyingNode.ChildNodes) list.Add (new XML (lib, node)); return list; }
/// <summary> /// XML.prototype.child ( propertyName ) /// /// The child method returns the list of children in this /// XML object matching the given propertyName. If propertyName is a numeric /// index, the child method returns a list containing the child at the /// ordinal position identified by propertyName. /// /// See ECMA 13.4.4.6 /// </summary> /// <param name="index"></param> /// <returns></returns> internal XMLList Child(long index) { XMLList list = new XMLList (lib); if (index > 0 || index < UnderlyingNode.ChildNodes.Count) list.Add (new XML (lib, UnderlyingNode.ChildNodes [(int)index])); return list; }
public void MatchChildren(XMLList list, XMLName xmlName, XmlNode parent, bool recursive) { foreach (XmlNode child in parent.ChildNodes) { if (xmlName.Matches (child)) list.Add (new XML (lib, child)); if (recursive) MatchChildren (list, xmlName, child, recursive); } }
/// <summary> /// XML.prototype.comments ( ) /// /// The comments method returns an XMLList containing the properties of this /// XML object that represent XML comments. /// /// See ECMA 13.4.4.9 /// </summary> private XMLList Comments() { XMLList list = new XMLList (lib); foreach (XmlNode child in UnderlyingNode.ChildNodes) { if (child is XmlComment) list.Add (new XML (lib, child)); } return list; }
/// <summary> /// XML.prototype.processingInstructions ( [ name ] ) /// /// When the processingInstructions method is called with one /// parameter name, it returns an XMLList containing all the /// children of this XML object that are processing-instructions /// with the given name. When the processingInstructions method /// is called with no parameters, it returns an XMLList containing /// all the children of this XML object that are processing-instructions /// regardless of their name. /// /// See ECMA 13.4.4.28 /// </summary> /// <returns></returns> internal XMLList ProcessingInstructions(XMLName xmlName) { XMLList list = new XMLList (lib); foreach (XmlNode child in UnderlyingNode.ChildNodes) { if (child is XmlProcessingInstruction) { if (xmlName == null || xmlName.Matches (child)) list.Add (new XML (lib, child)); } } return list; }
internal void MatchAttributes(XMLList list, XMLName xmlName, XmlNode parent, bool recursive) { if (parent is XmlDocument) parent = ((XmlDocument)parent).DocumentElement; if (!(parent is XmlElement)) return; foreach (XmlAttribute attr in parent.Attributes) { if (xmlName == null || xmlName.Matches (attr)) list.Add (new XML (lib, attr)); } if (recursive) { foreach (XmlNode node in parent.ChildNodes) MatchAttributes (list, xmlName, node, recursive); } }
private object Copy () { XMLList list = new XMLList (lib); foreach (XML xml in m_Nodes) { list.Add ((XML)xml.Copy ()); } return list; }