How to preserve newlines when formatting XML
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 3
- Joined: Thu Jan 05, 2006 2:22 pm
How to preserve newlines when formatting XML
Hi,
When I format my XML files, empty lines are removed. Is there a way to prevent this form happening. The empty lines are there for readability
Before:
After:
What I would like:
Is this possible?
Thanks in advance for any help!
Arjan Huijzer
When I format my XML files, empty lines are removed. Is there a way to prevent this form happening. The empty lines are there for readability

Before:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<test>
<node><a/></node>
<node><b/></node>
</test>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<test>
<node>
<a/>
</node>
<node>
<b/>
</node>
</test>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<test>
<node>
<a/>
</node>
<node>
<b/>
</node>
</test>
Thanks in advance for any help!
Arjan Huijzer
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Hi,
You can achieve that if you set the spaces to be preserved for the test element and to be stripped for the node element. You can set the preserve/strip spaces state for a node either using the xml:space attribute with the preserve and default as values or by adding the element name to the preserve or strip spaces element lists from Options->Preferences -- Editor / Format dialog.
Best Regards,
George
You can achieve that if you set the spaces to be preserved for the test element and to be stripped for the node element. You can set the preserve/strip spaces state for a node either using the xml:space attribute with the preserve and default as values or by adding the element name to the preserve or strip spaces element lists from Options->Preferences -- Editor / Format dialog.
Best Regards,
George
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service