How to select multiple nodes in different levels?

前端 未结 3 1067
遥遥无期
遥遥无期 2021-02-19 00:14

Having this (simplified) XML:




        
            Pol         


        
3条回答
  •  隐瞒了意图╮
    2021-02-19 00:26

    You can use a union in your XPath expression. Just use the operator: |

    //Document/Placemark/name | //Document/Placemark/Polygon/coordinates
    

    Don't use the // (descendant axis) if you don't need to. Using //, this would also work: //name | //coordinates. It's better performance-wise to specify the exact path.

提交回复
热议问题