Exemple #1
0
        /// <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);
        }
Exemple #5
0
 /// <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);
 }