xmlstarlet select value

前端 未结 1 1884
既然无缘
既然无缘 2020-12-13 21:31

This is the xml-data:


  
    
      
      

        
1条回答
  •  星月不相逢
    2020-12-13 21:43

    The key is to start from the ITEM node, not the identifyer:

    $ xmlstarlet sel -t -c "/DATA/TABLES/ITEM[identifyer/@V=1234]" test.xml
    
      
      
      
    
    

    Then you can pick out the bits you want:

    $ xmlstarlet sel -t -c "/DATA/TABLES/ITEM[identifyer/@V=1234]/*" test.xml
    
    
    $ xmlstarlet sel -t -v "/DATA/TABLES/ITEM[identifyer/@V=1234]/Property2/@V" test.xml
    qwerty
    

    0 讨论(0)
提交回复
热议问题