/// <summary> /// Retrieves the context node's attributes. /// </summary> /// <param name="node"> /// is the type of node. </param> public override void iterate(NodeType node, ResultBuffer copyInto, Node limitNode) { // only elements have attributes if (!(node is ElementType)) { return; } // get attributes ElementType elem = (ElementType)node; NamedNodeMap attrs = elem.value().Attributes; if (attrs == null) { return; } // add attributes for (int i = 0; i < attrs.Length; i++) { Attr attr = (Attr)attrs.item(i); copyInto.add(NodeType.dom_to_xpath(attr, node.TypeModel)); } }
/// <summary> /// Retrieve the the descendants of the context node and the context node /// itself. /// </summary> /// <param name="node"> /// is the type of node. </param> public override void iterate(NodeType node, ResultBuffer rs, Node limitNode) { // add self rs.add(node); // add descendants (new DescendantAxis()).iterate(node, rs, null); }
/// <summary> /// Get ancestor nodes of the context node and the context node itself. /// </summary> /// <param name="node"> /// is the type of node. </param> public override void iterate(NodeType node, ResultBuffer copyInto, Node limitNode) { // get ancestors AncestorAxis aa = new AncestorAxis(); aa.iterate(node, copyInto, null); // add self copyInto.add(node); }
/// <summary> /// Return the result of FollowingSiblingAxis expression /// </summary> /// <param name="node"> /// is the type of node. </param> public override void iterate(NodeType node, ResultBuffer copyInto, Node limitNode) { // XXX check for attribute / namespace node... if so return // empty sequence Node iterNode = node.node_value(); // get the children of the parent [siblings] do { iterNode = iterNode.NextSibling; if (iterNode != null) { NodeType nodeType = NodeType.dom_to_xpath(iterNode, node.TypeModel); if (nodeType != null) { copyInto.add(nodeType); } } } while (iterNode != null); }
/// <summary> /// Get the ancestors of the context node. /// </summary> /// <param name="node"> /// is the type of node. </param> // XXX unify this with descendants axis ? public override void iterate(NodeType node, ResultBuffer copyInto, Node limitNode) { if (limitNode != null && limitNode.isSameNode(node.node_value())) { return; } int before = copyInto.size(); // get the parent base.iterate(node, copyInto, limitNode); // no parent if (copyInto.size() == before) { return; } NodeType parent = (NodeType)copyInto.item(before); // get ancestors of parent iterate(parent, copyInto, limitNode); }
/// <summary> /// Using the context node retrieve the descendants of this node /// </summary> /// <param name="node"> /// is the type of node. </param> public override void iterate(NodeType node, ResultBuffer copyInto, Node limitNode) { addChildren(node, copyInto, true); }
/// <summary> /// create new rs and add the context node to it /// </summary> /// <param name="node"> /// is the node type </param> public override void iterate(NodeType node, ResultBuffer copyInto, Node limitNode) { copyInto.add(node); }