Generate/get xpath from XML node java

前端 未结 8 825
清酒与你
清酒与你 2020-11-22 10:39

I\'m interested in advice/pseudocode code/explanation rather than actual implementation.

  • I\'d like to go trough xml document
8条回答
  •  礼貌的吻别
    2020-11-22 11:26

    1. use w3c.dom
    2. go recursively down
    3. for each node there is easy way to get it's xpath: either by storing it as array/list while #2, or via function which goes recursively up until parent is null, then reverses array/list of encountered nodes.

    something like that.

    UPD: and concatenate final list in order to get final xpath. don't think attributes will be a problem.

提交回复
热议问题