In the past I've used decentxml as a lightweight reader/writer which retains everything as-is.
https://bitbucket.org/digulla/decentxml/wiki/Home пт, 30 нояб. 2018 г. в 02:47, Chris Barlock <[email protected]>: > SInce it is XML, you could use the Java DOM or Sax parsers. > > Chris > > > > > From: Marc Rohlfs <[email protected]> > To: [email protected] > Date: 11/29/2018 07:42 PM > Subject: How to rewrite POMs retaining the XML structure > > > > Hi all, > > is there a way to rewrite pom.xml files without loosing formatting, > ordering and comments? > > We need to (programmatically) do several changes on Maven POMs, e.g. > adding > and removing dependencies and properties. Currently we're using > the MavenXpp3Reader and MavenXpp3Writer classes to read and write the > pom.xml files, but in the output files, all comments are removed, the XML > nodes are reordered and formatting (indentations, empty lines) is lost. > Does anybody know a way how to read and write POM files without loosing > formatting ordering and comments? > > Best regards > Marc > > > > > -- Regards, Anton.
