>> English << | česky | Nederlands | Français | Español | По-русски | Deutsch | 中文 | Italiano | Polski ZVON > Tutorials > XPath Tutorial
>> Example 1 << | Prev | Next

The basic XPath syntax is similar to filesystem addressing. If the path starts with the slash / , then it represents an absolute path to the required element.
 
/AAA
Select the root element AAA

     <AAA>
          <BBB/>
          <CCC/>
          <BBB/>
          <BBB/>
          <DDD>
               <BBB/>
          </DDD>
          <CCC/>
     </AAA>
Open the example in XLab. | Tree view (JPG)
 
/AAA/CCC
Select all elements CCC which are children of the root element AAA

     <AAA>
          <BBB/>
          <CCC/>
          <BBB/>
          <BBB/>
          <DDD>
               <BBB/>
          </DDD>
          <CCC/>
     </AAA>
Open the example in XLab. | Tree view (JPG)
 
/AAA/DDD/BBB
Select all elements BBB which are children of DDD which are children of the root element AAA

     <AAA>
          <BBB/>
          <CCC/>
          <BBB/>
          <BBB/>
          <DDD>
               <BBB/>
          </DDD>
          <CCC/>
     </AAA>
Open the example in XLab. | Tree view (JPG)