JS中常用的xpath特性//选择所有dir元素的值等于xx的元素    
JS中常用的xpath特性
Dom.documentElement.selectNodes("server/dir[text()='xx']")    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择server元素下的所有dir元素:    
JS中常用的xpath特性
Dom.documentElement.selectNodes("server/dir")    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择server元素下的第一个dir元素:    
JS中常用的xpath特性
Dom.documentElement.selectSingleNode("server/dir");    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择server元素下accesstype等于3的多有dir元素:    
JS中常用的xpath特性
Dom.documentElement.selectNodes("server/dir[@accesstype=\"3\"]");    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择server元素下第一个dir元素:    
JS中常用的xpath特性
Dom.documentElement.selectNodes("server[postion() =1]/dir");    
JS中常用的xpath特性Dom.documentElement.selectNodes(
"server/dir[1]");    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择server元素下最后一个dir元素:    
JS中常用的xpath特性
Dom.documentElement.selectNodes("server/dir[last()]");    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择有三个祖先元素的file元素:    
JS中常用的xpath特性
Dom.documentElement.selectNodes("*/*/*/file");    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择有id属性的dir元素:    
JS中常用的xpath特性
Dom.documentElement.selectNodes("/dir[@id]");    
JS中常用的xpath特性   
JS中常用的xpath特性
//选择含有2个dir子元素的元素    
JS中常用的xpath特性
Dom.documentElement.selectNodes("/*[count(dir)=2]");   
JS中常用的xpath特性

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-09
  • 2021-06-26
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-12
  • 2022-01-18
  • 2021-05-30
  • 2021-10-02
  • 2022-12-23
相关资源
相似解决方案