Indentation of elements but not of comments
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 3
- Joined: Mon May 19, 2014 1:24 pm
Indentation of elements but not of comments
Post by MikeUnwalla »
I want to indent the elements in an XML document. Tools>Format and Indent Files lets me do this. To specify the indentation, I can use Options>Preferences>Editor/Format/XML.
Some of the elements have comments at the end of a line. Example:
I want the pattern element to be indented, but I don't want the comment on a new line. (I tried to use Elements Spacing, but I could not make it do what I want.) Is there a simple way to do what I want?
Mike Unwalla
www.techscribe.co.uk
Some of the elements have comments at the end of a line. Example:
Code: Select all
<pattern><!-- This is a comment -->
Mike Unwalla
www.techscribe.co.uk
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Indentation of elements but not of comments
Hello,
We've discussed this on the Oxygen users list, but I'm also mentioning it here in case anyone else wants something similar.
There is no option in Oxygen to tell the formatter to treat an XML comment differently.
Oxygen formats an element differently depending on its type of content (elements and/or text).
Given your description (that the line breaks before the comment), I can only assume that your "pattern" element contains only elements
(element-only content).
e.g.
In this case, if you want to force the formatter to keep the XML comment where it is without breaking the line, you can tell it that "pattern"
has "Mixed content" (elements and text). In Editor / Format / XML, go to the Elements spacing > "Mixed content" tab and Add the "pattern" element to the list.
Also note that if there is a space between the start tag and the comment, the Oxygen formatter will consider it's fair to replace the space with a line break.
Regards,
Adrian
We've discussed this on the Oxygen users list, but I'm also mentioning it here in case anyone else wants something similar.
There is no option in Oxygen to tell the formatter to treat an XML comment differently.
Oxygen formats an element differently depending on its type of content (elements and/or text).
Given your description (that the line breaks before the comment), I can only assume that your "pattern" element contains only elements
(element-only content).
e.g.
Code: Select all
<root>
<pattern><!-- This is a comment -->
<element>
</element>
</pattern>
</root>
has "Mixed content" (elements and text). In Editor / Format / XML, go to the Elements spacing > "Mixed content" tab and Add the "pattern" element to the list.
Also note that if there is a space between the start tag and the comment, the Oxygen formatter will consider it's fair to replace the space with a line break.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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