Modify XML node but keep the XML file format intact

后端 未结 3 468
抹茶落季
抹茶落季 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:29

    You could try VTD-XML.

    Since this library builds an index while keeping the file content as-is, its manipulation API will allow to "patch" your file while keeping the rest intact.

    Using the VTD-XML API, you will be able to navigate your XML like a DOM tree (even using XPath) and do some modifications (insert elements, insert attributes, etc.)

提交回复
热议问题