Text only | Skip links
Skip links||IT Services, University of Oxford

1. First steps with Oxygen

In this first exercise you will learn how to use Oxygen to
  • create a new XML document
  • add markup to a document
  • keep your document well-formed
  • display and edit your document without seeing tags

2. Creating a new document

Start up Oxygen, and click the New Document icon at top left (or select New Document from the File menu, or type CTRL-N.) to display the New dialog.

Select the default XML option, and press OK.

In the "Create an XML Document" dialog, uncheck the tick box Use a DTD or a schema, since we don't yet have a schema.

Press OK to continue.

Oxygen opens a blank document, containing just the XML declaration at the start. As you start typing in XML, notice how hard Oxygen tries to make your document well-formed.

  • type in <div type=" and pause
  • notice that Oxygen supplies the closing quote for you
  • continue typing verse and move the cursor after the closing quote (use an arrow key)
  • Type the closing > and note that Oxygen immediately supplies the closing </div> for you. Press the RETURN key

3. Adding text to a document

Your document should now look like this:

  • Select File from the Document menu
  • Select Insert File from the submenu that opens.
  • Navigate to the file progress.txt in your working directory (or download it) and insert it into your document.

This is a plain text version of the poem at the start of our sample Punch issue. In the rest of this exercise we will add some minimal tagging.

4. Tagging bits of a document

  • With the mouse, select the word ‘PROGRESS’ at the start of the text.
  • Press CTRL-E (or select XML Refactoring/Surround with Tag from the Document menu).
  • Type the name of the tag you want to use into the popup: this is a heading, so type head and press OK

Repeat the process for the whole of the paragraph in square brackets: this time, tag it as a <p>.

5. Tagging the poem

We will tag the poem proper using <lg> to enclose each stanza, and <l> to enclose each <l>.

  • Try typing the sequence <lg><l> at the start of the first line. Delete the unwanted </l>> and </lg> tags inserted by Oxygen.
  • Put the cursor at the end of the first stanza (after the word ‘sticks’) and type <
  • A small menu opens, showing that you can enter a closing-tag (to close the <l> element) here. Select it.
  • Type another < and the same menu appears: but note that this time the closing-tag to be inserted is a </lg>. Select this, and the document becomes valid -- no red lines visible.
  • What will happen if you repeat the process, do you think? Try it and see!

6. Tagging the poem properly

Although well-formed our tagging is not very honest. We have a single <l> element containing several lines, and lots of stanzas which are not tagged as anything at all. If we were validating this document against a schema we'd be in trouble.

  • put the cursor at the end of the first line (after ‘die!’)
  • select XML Refactoring/Split Element from the Document menu.

This closes the current <l> and immediately opens a new one, so that our document remains valid. We just need to repeat this process for each line. We could do that by repeating what we just did. Or, more simply perhaps, we could add the XML Document Refactoring toolbar, which would provide a single button to do the job.

We'll do something even simpler. Use the mouse to select the sequence of characters you just inserted (</l><l>); copy it with CTRL-C; move the cursor to the end of the next line; paste it with CTRL-V. Repeat this for each line, except the last one of course.

7. Tagging another way

Some people just don't like tags. Fortunately, Oxygen also has a ‘tag free’ editing mode: it works by displaying parts of the text which are tagged in different ways in different styles. We specify the style for each tag by means of a stylesheet associated with the document.

  • Select XML Document/Associate XSLT/CSS Stylesheet from the Document menu (or click the appropriate button if you can find it). In the Associate dialog, navigate to the file progress.css in your working directory (or download it) and select it. Observe that a new processing instruction is added at the start of your document.
  • At the bottom of the editing window, you see a choice of Mode displays: Text (the default), Grid, and Author. Select the last. Observe that the display changes and a new Menu option (Author) is now available. Select this and observe the effect of the various command options on it.
  • Choose No Tags for the next part of this exercise.

8. Quick splitting

  • Use the mouse to select the the rest of the poem (from the word ‘The’ to the word ‘shrink’) excluding the name ‘Evoe’ at the end.
  • Use CTRL-E to tag this all as a single <lg>.
  • Select the same stratch of text again and tag it as a single <l> in the same way.
  • Now place the cursor at the end of the first line of the second stanza (after ‘around’). Press RETURN. A menu offers you the choice of splitting the <l> element. Press RETURN again.
  • Move on to the next line (after ‘banks’) and repeat. Repeat for each subsequent line in the poem.
  • To split the stanzas, put the cursor at the end of the last line of the stanza, and use the right arrow key to move it between the invisible tags (or switch back to Text mode). You should then be able to split the stanzas in exactly the same way.
  • You can also experiment with other ways of splitting the text, of course. If you get into a mess, use CTRL-Z to undo the last change you made. Remember you can switch between Author and Text views as much as you like.
  • Finally, tag the name of the author of the poem (‘Evoe’) using the <signed> element.


Date: 2008-07-07
Copyright University of Oxford