ZVON > Tutorials > XPointer Tutorial
>> Example 1 / 3 << | Prev | Next |
Contents > element() scheme > Child sequence

Child sequence

Child sequence is an absolute path to the selected element. It is a sequence of slashes "/" and numbers (starting with "/"). Each integer n locates the nth child of the previously located element.

XPointer:element(/1)
Corresponding XPath:/*[1]
Matches root element

<AAA>
   <BBB>
      <CCC/>
      <CCC/>
   </BBB>
   <BBB>
      <CCC/>
      <CCC/>
   </BBB>
</AAA>
XPointer:element(/1/2)
Corresponding XPath:/*[1]/*[2]
Matches the second child of the root element.

<AAA>
   <BBB>
      <CCC/>
      <CCC/>
   </BBB>
   <BBB>
      <CCC/>
      <CCC/>
   </BBB>
</AAA>
XPointer:element(/1/2/1)
Corresponding XPath:/*[1]/*[2]/*[1]
Matches the first child of the second child of the root element.

<AAA>
   <BBB>
      <CCC/>
      <CCC/>
   </BBB>
   <BBB>
      <CCC/>
      <CCC/>
   </BBB>
</AAA>