Oxygen and Text Formatting
From NGDCWikiSometimes 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.
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
- Select Options > Preferences > Format and set up like the image on the right
- uncheck 'Hard Line Wrap'
- check 'Format and indent the document on open'
- set 'Line width' to a large number (I like 500)
- In same Dialogue box got to Format > XML and set up like image on right
- check 'Preserve text as is'
- 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:
- From Project panel, right click on project folder, select '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
- ctrl+j each file
- This joins all xml tags and text in the file( and makes it really really hard to read)
- 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
- in file, select element and ctrl+j