Xpath Tools

xpath

    In the Find language information in an XML document, it applies equally to retrieve the HTML document. The results are returned List

 xpath aids

     1, Chrome plug-in: XPath Helper

     1. Open: Ctrl + X-Shift +

     2. Close: ctrl + shift + X

     2, Firfox plug: XPath checker

     3, XPath expression editing tools: XML quire

XPath matching rules

 Select node

    /: Starting from the root selected

    //: Find node from the entire document

       //price    /bookstore/book//price

    @: Choose property of a node

      //title[@lang="en"]

 @usage of

    1, select a node: // title [@ lang = "EN"]

    2, select n nodes: // title [@lang]

    3, the attribute value of the selected node: // A / the src @

      <a class=...,src="http://...">

    4, matching multipath

      1, symbol: |

    et: acquiring title and price book nodes in all nodes

    //book/title | //book/price

    5, function

      () Contains: an attribute value matching node contains certain strings

    and:  

      //title[contains(@lang,"e")]/text()

       6, siblings get
          // title [@ lang = "chs "] / following-sibling :: price

 

Guess you like

Origin www.cnblogs.com/hongliangzhao/p/12553280.html