Modify XML node but keep the XML file format intact

后端 未结 3 473
抹茶落季
抹茶落季 2020-12-17 00:57

How may I modify a XML file without any change like attributes ordering, tag expansion and encoding? (My preference is DOM API)

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-17 01:38

    This is not possible with DOM, since DOM does not know the attributes' order.

    You could use a low-level API such as StAX, javax.xml.stream, but StAX is not exactly comfortable to use.

提交回复
热议问题