Partager via


Axes (Windows CE 5.0)

Send Feedback

An axis is used in a location path to specify the tree relationship between the nodes selected by the location step and the context node.

Axes Description
ancestor Contains the ancestors of the context node; the ancestors of the context node consist of the parent of the context node and the parent's parent and so on; thus the ancestor axis will always include the root node unless the context node is the root node.
ancestor-or-self Contains the context node and the ancestors of the context node; thus the ancestor axis will always include the root node.
attribute Contains the attributes of the context node; the axis will be empty unless the context node is an element.
child Contains the children of the context node.
descendant Contains the descendants of the context node; a descendant is a child or a child of a child and so on; thus the descendant axis never contains attribute or namespace nodes.
descendant-or-self Contains the context node and the descendants of the context node.
following Contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes and namespace nodes.
following-sibling Contains all the following siblings of the context node; if the context node is an attribute node or name space node, the following-sibling axis is empty.
namespace Contains the name space nodes of the context node; the axis will be empty unless the context node is an element.
parent Contains the parent of the context node, if there is one.
preceding Contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes and name space nodes.
preceding-sibling Contains all the preceding siblings of the context node; if the context node is an attribute node or name space node, the preceding-sibling axis is empty.
self Contains just the context node itself.

Remarks

  • name space
    Each element has an associated set of name space nodes, one for each distinct name space prefix that is in scope for the element (including the xml prefix, which is implicitly declared by the XML Name spaces Recommendation) and one for the default name space if one is in scope for the element. The element is the parent of each of these name space nodes; however, a name space node is not a child of its parent element. Elements never share name space nodes; if one element node is not the same node as another element node, then none of the name space nodes of the one element node will be the same node as the name space nodes of another element node. This means that an element will have a name space node:

    • For every attribute on the element whose name starts with xmlns:
    • For every attribute on an ancestor element whose name starts xmlns: unless the element itself or a nearer ancestor redeclares the prefix
    • For an xmlns attribute, if the element or some ancestor has an xmlns attribute, and the value of the xmlns attribute for the nearest such element is non-empty

    The "sample" element in the following instance.

    <A xmlns="urn:A">
      <B xmlns:test="sample">
        <sample xmlns:sampletest="sampletest"/>
      </B>
    </A>
    

    Contains the following name space nodes:

    xmlns="urn:A"

    xmlns:test="sample"

    xmlns:sampletest="sampletest"

    The "sample" element in the following instance.

    <A xmlns="urn:A">
      <B  xmlns:test="sample">
        <sample xmlns:sampletest="sampletest" xmlns:bar="test"/>
      </B>
    </A>
    

    Contains the following name space nodes:

    xmlns:sampletest="sampletest"

    xmlns:test="test"

    Note   An attribute "undeclares" the default name space.

    A name space node has an expanded-name: the local part is the name space prefix (this is empty if the name space node is for the default name space); the name space Uniform Resource Identifier (URI) is always null.

The string-value of a name space node is the name space URI that is being bound to the name space prefix; if it is relative, it must be resolved just like a name space URI in an expanded-name.

See Also

Location Paths

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.