網址:https://www.w3school.com.cn/example/xmle/books.xml
使用@屬性方式查找元素
案例:獲取//*[@category] 屬性

2.使用父節點獲取元素唯一性
如果在搜索欄中,使用//*[@lang='en'],會找到4個,我們可以使用父類中唯一,定位出唯一元素
//book[1]//*[@lang='en']
父層級關系與屬性使用
//bookstore/book[1]/*[@*]

2.屬性使用not 反向取數
//bookstore/book[1]/*[not (@*)]

3.使用使用and 匹配多個滿足要求的元素
//book[@category and @cover]

4.屬性使用or定位多個元素
//book[@category or @cover]

2.查找文本內容
1.在文本中使用大於小於符號獲取元素
//book/price[text()=29.99]
或者這樣也可以
//book/price[.>40]

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

2 根據文本精確查找,查找文本為29.99的內容
//book/price[.=29.99] #.表示文本
//book/price[.>40]

3.使用contains模糊匹配
//book/price[contains(.,"29")]
使用contains屬性進行模糊匹配
//book/title[contains(@lang,"e")]

