In-Line XML Editor

From NovaOrdis Knowledge Base
Revision as of 07:48, 12 November 2016 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Overview

InLineXmlEditor is an API that can be used to modify XML files on disk directly from Java programs.

A typical usage pattern is the following:

File file = ...;
InLineXmlEditor editor = new InLineXmlEditor(file);

boolean changeOccurred = editor.set("/path/in/document", "value");

if (changeOccurred) {

    editor.save();
}
else {

  //
  // the value we're trying to set is identical with the value present in the file, react accordingly 
  //
  
}

The modification preserves the original format, nothing is modified except the value that is being changed.