How to flatten an XML file into a set of xpath expressions?

后端 未结 2 1628
暗喜
暗喜 2021-01-03 08:25

Consider I have the following example XML file:


   
2条回答
  •  北荒
    北荒 (楼主)
    2021-01-03 09:29

    My recommendation is to use a SAX parser. wiki entry for SAX , Xerces: a SAX parser for java by Apache

    On each start element, add the name of the element onto the end of a list. On each end element, remove the last list entry. When you run into content, and you want to output your xpath, it can be retrieved by iterating the list.

提交回复
热议问题