History | Edit

Question

How can I force the Oxygen XML Author Component to save the XML with zero indent size and not to break the line inside block elements?

Answer

Usually, in a standalone version of Oxygen XML Editor, the Editor > Format and Editor > Format > XML preferences pages allow you to control the way the XML is saved on the disk after you edit it in the Author mode.

In the editor application (Standalone or Eclipse-based), you can either bundle a default set of options or use the PluginWorkspace.setGlobalObjectProperty(String, Object) API:
//For not breaking the line
//Long line
pluginWorkspace.setObjectProperty("editor.line.width", new Integer(100000));
//Do not break before inline elements
pluginWorkspace.setObjectProperty("editor.format.indent.inline.elements", false)
;

//For forcing zero indent
//Force indent settings to be controlled by us
pluginWorkspace.setObjectProperty("editor.detect.indent.on.open", false);
//Zero indent size
pluginWorkspace.setObjectProperty("editor.indent.size.v9.2", 0);
In the Oxygen XML Author Component, you can either bundle a fixed set of options, or use our Java API to set properties that overwrite the default options:
    //For not breaking the line
    //Long line
    AuthorComponentFactory.getInstance().setObjectProperty
("editor.line.width", new Integer(100000));
    //Do not break before inline elements
    AuthorComponentFactory.getInstance().setObjectProperty
("editor.format.indent.inline.elements", false);

    //For forcing zero indent
    //Force indent settings to be controlled by us
    AuthorComponentFactory.getInstance().setObjectProperty
("editor.detect.indent.on.open", false);
    //Zero indent size
    AuthorComponentFactory.getInstance().setObjectProperty
("editor.indent.size.v9.2", 0);