English | česky | Nederlands | Français | Español | По-русски | Deutsch | >> 中文 << | Italiano | Polski ZVON > Tutorials > XPath Tutorial
>> 实例 2 << | 前页 | 后页

如果路径以双斜线 // 开头, 则表示选择文档中所有满足双斜线//之后规则的元素(无论层级关系)
 
//BBB
选择所有BBB元素

     <AAA>
          <BBB/>
          <CCC/>
          <BBB/>
          <DDD>
               <BBB/>
          </DDD>
          <CCC>
               <DDD>
                    <BBB/>
                    <BBB/>
               </DDD>
          </CCC>
     </AAA>
在XLab中打开实例 | 树视图 (JPG)
 
//DDD/BBB
选择所有父元素是DDD的BBB元素

     <AAA>
          <BBB/>
          <CCC/>
          <BBB/>
          <DDD>
               <BBB/>
          </DDD>
          <CCC>
               <DDD>
                    <BBB/>
                    <BBB/>
               </DDD>
          </CCC>
     </AAA>
在XLab中打开实例 | 树视图 (JPG)