Oxygen and Text Formatting

From NGDC Wiki
Jump to: navigation, search
Sometimes xml files may have returns or tabs embedded within the text. Sometimes, this is appropriate for "listing" items in a free text field, however, in most cases this is accidental and undesired. It may cause funky html output, prevent find/replace functionality and instigate unnecessary headaches. The image to the right shows the 'purpose' element with many unwanted returns in the content.
Error creating thumbnail: Unable to save thumbnail to destination
Undesired returns in paragraph of text

These are some of the solutions I've come up with so far to deal with this - please add your own method if you find another way!
Remove hard wrapping

  1. Select Options > Preferences > Format and set up like the image on the right
    Error creating thumbnail: Unable to save thumbnail to destination
    1.Preferences > Format
    • uncheck 'Hard Line Wrap'
    • check 'Format and indent the document on open'
    • set 'Line width' to a large number (I like 500)
  2. In same Dialogue box got to Format > XML and set up like image on right
    Error creating thumbnail: Unable to save thumbnail to destination
    2. Preferences > Format > XML
    • check 'Preserve text as is'
  3. Selection Options > Preferences > Text
    • Check 'Line Wrap' box

In my experience, these preferences will NOT automatically fix the formatting. You may have to do one or all of the following:
Pretty Print

  1. From Project panel, right click on project folder, select 'Open All Files'
    Error creating thumbnail: Unable to save thumbnail to destination
    Open All Files
    • Because you previously checked 'Format and indent the document on open' in Preference, this automatically "pretty prints" all of the XML files
    • This helps with find/replace functions
    • However, it does not get rid of carriage returns within an element
    • You must save each file (ctrl+w, ctrl+s, repeat)

Remove unwanted returns and tabs for entire document

  1. ctrl+j each file
    • This joins all xml tags and text in the file( and makes it really really hard to read)
  2. Select 'pretty print' button
    • This combo will delete ALL extra tabs and returns within elements
    • I think this is made possible by the 'Preserve text as is' option...

Remove unwanted returns and tabs for just one field

  1. in file, select element and ctrl+j


Error creating thumbnail: Unable to save thumbnail to destination
Example of end result