Creating New XML Data in Oyxgen XML Editor
- Michael

- Dec 10, 2021
- 3 min read
Updated: Dec 13, 2021
In a previous Coding Diaries episode, I took Oxygen XML Editor for a test drive. I imported a Word document as a DITAMAP, and explored some basic operations in the application with my example document. It did not take long for me to realize that this was a program I wanted to learn more about.
What is the Oxygen XML Editor? According the the application's official documentation, "It is a comprehensive solution for authors who want to edit XML documents visually, with or without extensive knowledge about XML and XML-related technologies". As a technical editor, I'll need to be able to directly edit data files in a structured format like XML or JSON or DITA, and editors like Oxygen's are purpose-built for this task.
To get started, I'll make some new XML data. With the Oxygen XML Editor window open, let's create a new XML file. Select File, New in the menu to open the New File dialog, or use the keyboard shortcut Ctrl+N. I want to make some new data.
The popup menu reads "Choose a file template," and is accompanied by a list of template options. Select XML Document from those options and choose a name for the file. If you'd prefer to save the file in a different location than the default, select a different folder in the options. Once everything looks good, select the Create option.
At the center of the screen, the composition panel displays the new document. A new XML file has been created, and the first line of code has been automatically generated via the template. A prompt at the bottom of the screen explains that "a well-formed document requires a root element," so I'll begin to create a root element on line 3 of this new XML file.
As an example, I want to take an object that I can break down into parts. I'll focus on one of those parts and consider some of its attributes. In the example of a car, you have the engine and its parts, the electrical system, the cooling system, and so on. I'll focus on one of the elements of the cooling system: the water pump, which itself includes a number of parts.
Let's use XML data to document information about the impeller, one of the parts of the water pump.
I'll write out some quick XML code in Notepad and paste it into Oxygen. Oxygen interprets the organization of the data in the raw text and adds spacing where appropriate.
<car>
<cooling-system>
<water-pump>
<housing />
<shaft />
<impeller>
<date-installed>2015-06-02</date-installed>
<body>
<body-width unit="inch">.456</body-width>
<body-type id="key">89981</body-type>
</body>
</impeller>
</water-pump>
</cooling-system>
</car>This XML situates some specific car parts within the overall context of the car. I've included three of the many parts of a water pump. For the impeller, I've added two secondary elements and given them both attributes.
On the bottom-left of the application window I can see the outline that has been created from this data. I can use the outline to highlight sections of the composition. I can click on the tags to expand and contract the sections in the Outline panel. In the composition area, next to the line numbers, there are small arrows that can similarly expand and contract elements in the composition. I'll leave them as they are for now.
If I click on the "body-width" element in the impeller's "body" tag, I can see the "unit" attribute listed in the Attribute panel in the workspace. I can add new attributes directly in this panel that will immediately be added to the appropriate location in the composition. So there are multiple ways to add content to the active XML file.
I see how easy it is to get started developing XML data in Oxygen. Now I want to see how I can bring this data into a DITAMAP. I want the DITAMAP to be organized based on the structure of the <car> root in my XML file. In my next blog, I'll create this same data structure in DITA so I can generate some technical documentation related to the water pump and the impeller.



Comments