XML Viewer: Difference between revisions
Updated by push_wiki.py |
Updated by push_wiki.py |
||
| Line 7: | Line 7: | ||
== Running XML Viewer == | == Running XML Viewer == | ||
XML Viewer is a Java 21 desktop (Swing) application: | Native install packages for Windows, macOS, and Linux are available from the [[Downloads]] page and are the preferred installation method. | ||
Alternatively, XML Viewer can be run directly from the distribution archive. It is a Java 21 desktop (Swing) application: | |||
java -jar xmlviewer.jar [optional path to XML file] | java -jar xmlviewer.jar [optional path to XML file] | ||
Latest revision as of 17:28, 1 April 2026
XML Viewer is a desktop application for exploring XML documents as an interactive, expandable tree. It supports configurable display modes, multi-language element name translation, and adjustable tree expansion depth. It is designed for viewing structured XML files such as SAP IDoc messages, Commander4j configuration files, and production schedule exports.
Purpose
XML Viewer makes it practical to inspect complex XML files that are difficult to read as raw text. Element names can be translated into plain-language descriptions (for example, the SAP field code ABWKZ becomes "Deviation indicator" in the English translation), and the tree can be expanded to a specific depth to give a high-level overview without showing every leaf value.
Running XML Viewer
Native install packages for Windows, macOS, and Linux are available from the Downloads page and are the preferred installation method.
Alternatively, XML Viewer can be run directly from the distribution archive. It is a Java 21 desktop (Swing) application:
java -jar xmlviewer.jar [optional path to XML file]
If a file path is provided on the command line, that file is opened immediately on launch. Otherwise, the last-opened file from the configuration is loaded.
Loading a Document
Click the Open XML Document button in the right sidebar, or pass a file path on the command line. Only well-formed XML files are supported. Click Reload XML Document to re-read the current file after it has been changed externally.
Display Modes
Standard Mode
The XML hierarchy is displayed exactly as it appears in the file — elements nest within their parent elements, forming a tree that mirrors the XML structure.
Flat Mode
Leaf elements (those containing only text, no child elements) are collapsed into their parent's row rather than appearing as separate tree nodes. Only elements that contain child elements appear as tree nodes. This produces a more compact view of documents with many small leaf values.
Toggle between modes using the View Mode button in the right sidebar.
Tree Expansion Control
The top toolbar provides four buttons:
- Expand All — expand every node in the tree
- Expand Selected — expand only the selected subtree
- Collapse Selected — collapse the selected subtree
- Collapse All — collapse everything to root level
The − and + buttons in the toolbar adjust the current expansion level (shown as a number between the buttons). Clicking Refresh after changing the level re-expands the tree to that depth.
The expansion level is saved in the configuration and restored on next launch.
Translation
XML Viewer can replace technical XML element names and values with plain-language descriptions from a translation file.
Enabling Translation
Toggle translations using the View Translations button. The Translation dropdown at the bottom of the window selects which translation file to use. The Language dropdown selects the language within that file.
Built-in Translation Files
| File | Contents |
|---|---|
| matmas05.xml | SAP MATMAS05 IDoc field translations |
| zmatmas03.xml | SAP ZMATMAS03 IDoc field translations |
| productionschedule.xml | Production schedule export field translations |
| config.xml | Commander4j configuration element translations |
| default.xml | Generic fallback translations |
Languages
The default installation includes English, French, German, and Italian. The active language can be changed at any time from the Language dropdown.
Adding Translations
Translation files are XML documents located in xml/translations/. Each file maps element names, attribute names, element values, and attribute values to their translated equivalents for each language. Elements without a translation entry are shown using their original name from the XML file.
Other Display Options
| Button | Effect |
|---|---|
| View Icons | Show or hide the icon column next to each tree node |
| View Brackets | Wrap element values in [ ] brackets to distinguish them from element names
|
Configuration
config.xml
Located at xml/config/config.xml. Stores the last-opened file path, selected translation file, selected language, current expansion level, and the state of all four display toggles (mode, translations, brackets, icons). Updated automatically on exit.
log4j2.xml
Located at xml/log/log4j2.xml. Controls logging to logs/XML_View.log. Log files rotate at 10 MB and are retained for 14 days.
fonts.xml / icons
Icons are loaded from images/xmlIcons/. If an icon file referenced by a translation is not found, the icon column is left blank for that element without an error.
See also: TreeDoc, Middleware4j, Label Template Syntax