private static byte GetAxisNumber(XdmAxis axis) { switch (axis) { case XdmAxis.Ancestor: return(Axis.ANCESTOR); case XdmAxis.AncestorOrSelf: return(Axis.ANCESTOR_OR_SELF); case XdmAxis.Attribute: return(Axis.ATTRIBUTE); case XdmAxis.Child: return(Axis.CHILD); case XdmAxis.Descendant: return(Axis.DESCENDANT); case XdmAxis.DescendantOrSelf: return(Axis.DESCENDANT_OR_SELF); case XdmAxis.Following: return(Axis.FOLLOWING); case XdmAxis.FollowingSibling: return(Axis.FOLLOWING_SIBLING); case XdmAxis.Namespace: return(Axis.NAMESPACE); case XdmAxis.Parent: return(Axis.PARENT); case XdmAxis.Preceding: return(Axis.PRECEDING); case XdmAxis.PrecedingSibling: return(Axis.PRECEDING_SIBLING); case XdmAxis.Self: return(Axis.SELF); } return(0); }
bool MoveTo(XdmAxis axis) { IEnumerator en = this.currentNode.EnumerateAxis(axis); if (en.MoveNext()) { this.currentNode = (XdmNode)en.Current; switch (axis) { case XdmAxis.Attribute: case XdmAxis.Child: case XdmAxis.Namespace: this.currentSequence = en; break; default: this.currentSequence = null; break; } return(true); } return(false); }
/// <summary> /// Get an enumerator that selects all the nodes on one of the XPath /// axes, provided they have a given name. The nodes selected are those of the principal /// node kind (elements for most axes, attributes for the attribute axis, namespace nodes /// for the namespace axis) whose name matches the name given in the second argument. /// </summary> /// <param name="axis"> /// The axis to be navigated, for example <c>XdmAxis.Child</c> for the child axis. /// </param> /// <param name="nodeName"> /// The name of the required nodes, for example <c>new QName("", "item")</c> to select /// nodes with local name "item", in no namespace. /// </param> /// <remarks> /// The nodes are returned in axis order: that is, document order for a forwards /// axis, reverse document order for a reverse axis. /// </remarks> public IEnumerator EnumerateAxis(XdmAxis axis, QName nodeName) { int kind; switch (axis) { case XdmAxis.Attribute: kind = net.sf.saxon.type.Type.ATTRIBUTE; break; case XdmAxis.Namespace: kind = net.sf.saxon.type.Type.NAMESPACE; break; default: kind = net.sf.saxon.type.Type.ELEMENT; break; } NamePool pool = ((NodeInfo)value).getConfiguration().getNamePool(); int nameCode = pool.allocate("", nodeName.Uri, nodeName.LocalName); NameTest test = new NameTest(kind, nameCode, pool); return(new SequenceEnumerator(((NodeInfo)value).iterateAxis(GetAxisNumber(axis), test))); }
/// <summary> /// Get an enumerator that supplies all the nodes on one of the XPath /// axes, starting with this node. /// </summary> /// <param name="axis"> /// The axis to be navigated, for example <c>XdmAxis.Child</c> for the child axis. /// </param> /// <remarks> /// The nodes are returned in axis order: that is, document order for a forwards /// axis, reverse document order for a reverse axis. /// </remarks> public IEnumerator EnumerateAxis(XdmAxis axis) { return(new SequenceEnumerator(((NodeInfo)value).iterateAxis(GetAxisNumber(axis)))); }
bool MoveTo(XdmAxis axis) { IEnumerator en = this.currentNode.EnumerateAxis(axis); if (en.MoveNext()) { this.currentNode = (XdmNode)en.Current; switch (axis) { case XdmAxis.Attribute: case XdmAxis.Child: case XdmAxis.Namespace: this.currentSequence = en; break; default: this.currentSequence = null; break; } return true; } return false; }
/// <summary> /// Get an enumerator that selects all the nodes on one of the XPath /// axes, provided they have a given name. The nodes selected are those of the principal /// node kind (elements for most axes, attributes for the attribute axis, namespace nodes /// for the namespace axis) whose name matches the name given in the second argument. /// </summary> /// <param name="axis"> /// The axis to be navigated, for example <c>XdmAxis.Child</c> for the child axis. /// </param> /// <param name="nodeName"> /// The name of the required nodes, for example <c>new QName("", "item")</c> to select /// nodes with local name "item", in no namespace. /// </param> /// <remarks> /// The nodes are returned in axis order: that is, document order for a forwards /// axis, reverse document order for a reverse axis. /// </remarks> public IEnumerator EnumerateAxis(XdmAxis axis, QName nodeName) { int kind; switch (axis) { case XdmAxis.Attribute: kind = net.sf.saxon.type.Type.ATTRIBUTE; break; case XdmAxis.Namespace: kind = net.sf.saxon.type.Type.NAMESPACE; break; default: kind = net.sf.saxon.type.Type.ELEMENT; break; } NamePool pool = ((NodeInfo)value).getConfiguration().getNamePool(); int nameCode = pool.allocate("", nodeName.Uri, nodeName.LocalName); NameTest test = new NameTest(kind, nameCode, pool); return new SequenceEnumerator(((NodeInfo)value).iterateAxis(GetAxisNumber(axis), test)); }
/// <summary> /// Get an enumerator that supplies all the nodes on one of the XPath /// axes, starting with this node. /// </summary> /// <param name="axis"> /// The axis to be navigated, for example <c>XdmAxis.Child</c> for the child axis. /// </param> /// <remarks> /// The nodes are returned in axis order: that is, document order for a forwards /// axis, reverse document order for a reverse axis. /// </remarks> public IEnumerator EnumerateAxis(XdmAxis axis) { return new SequenceEnumerator(((NodeInfo)value).iterateAxis(GetAxisNumber(axis))); }
private static byte GetAxisNumber(XdmAxis axis) { switch (axis) { case XdmAxis.Ancestor: return Axis.ANCESTOR; case XdmAxis.AncestorOrSelf: return Axis.ANCESTOR_OR_SELF; case XdmAxis.Attribute: return Axis.ATTRIBUTE; case XdmAxis.Child: return Axis.CHILD; case XdmAxis.Descendant: return Axis.DESCENDANT; case XdmAxis.DescendantOrSelf: return Axis.DESCENDANT_OR_SELF; case XdmAxis.Following: return Axis.FOLLOWING; case XdmAxis.FollowingSibling: return Axis.FOLLOWING_SIBLING; case XdmAxis.Namespace: return Axis.NAMESPACE; case XdmAxis.Parent: return Axis.PARENT; case XdmAxis.Preceding: return Axis.PRECEDING; case XdmAxis.PrecedingSibling: return Axis.PRECEDING_SIBLING; case XdmAxis.Self: return Axis.SELF; } return 0; }