A way to compact XML files, to reverse indenting
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 4
- Joined: Thu Nov 12, 2009 6:24 pm
A way to compact XML files, to reverse indenting
Post by Michael_DC »
Hi,
Is there a way to compact XML files, to reverse indenting (an equivalent to BBEdit's Format:Compact)? In order to import Adobe XMP file into Acrobat all whitespace needs to be removed (AFAIK).
Michael
Is there a way to compact XML files, to reverse indenting (an equivalent to BBEdit's Format:Compact)? In order to import Adobe XMP file into Acrobat all whitespace needs to be removed (AFAIK).
Michael
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: A way to compact XML files, to reverse indenting
Post by sorin_ristache »
Hello,
You can compact the text if you set a large line width for the Format and Indent action from menu Options -> Preferences -> Editor -> Format -- Line width and run the action Format and Indent. For example you can set the line width to 1,000 or 10,000 characters.
Regards,
Sorin
You can compact the text if you set a large line width for the Format and Indent action from menu Options -> Preferences -> Editor -> Format -- Line width and run the action Format and Indent. For example you can set the line width to 1,000 or 10,000 characters.
Regards,
Sorin
-
- Posts: 4
- Joined: Thu Nov 12, 2009 6:24 pm
Re: A way to compact XML files, to reverse indenting
Post by Michael_DC »
Hello Sorin,sorin wrote:Hello,
You can compact the text if you set a large line width for the Format and Indent action from menu Options -> Preferences -> Editor -> Format -- Line width and run the action Format and Indent. For example you can set the line width to 1,000 or 10,000 characters.
Regards,
Sorin
thanks for your help. This didn't remove the returns (CR/LF), though. As a workaround I used the Regex "(\n *)+?" search and replace to get the text compact.
Best,
Michael
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: A way to compact XML files, to reverse indenting
Post by sorin_ristache »
Hello,
Setting the line width for the Format and Indent action to a large value in Preferences -> Editor -> Format and running the action Format and Indent should remove the end of line characters by compacting the text lines according with the new line width. If an element name with the text lines that you want to compact does not have the attribute xml:space="preserve" and is not in the list Preserve space elements from Preferences -> Editor -> Format -> XML the text lines from that element are compacted on a single line. If the text is longer than the line width that was set in Preferences the Format and Indent action breaks the text by inserting an end of line at that line width.
Regards,
Sorin
Setting the line width for the Format and Indent action to a large value in Preferences -> Editor -> Format and running the action Format and Indent should remove the end of line characters by compacting the text lines according with the new line width. If an element name with the text lines that you want to compact does not have the attribute xml:space="preserve" and is not in the list Preserve space elements from Preferences -> Editor -> Format -> XML the text lines from that element are compacted on a single line. If the text is longer than the line width that was set in Preferences the Format and Indent action breaks the text by inserting an end of line at that line width.
Regards,
Sorin
-
- Posts: 4
- Joined: Thu Nov 12, 2009 6:24 pm
Re: A way to compact XML files, to reverse indenting
Post by Michael_DC »
Hi Sorin,
I followed all your instructions regarding the setting of the preferences (Line width: 10000). Also, none of the elements is in the "Preserve space" list and still: no success,I'm afraid to say.
Best,
Michael
I followed all your instructions regarding the setting of the preferences (Line width: 10000). Also, none of the elements is in the "Preserve space" list and still: no success,I'm afraid to say.
Best,
Michael
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: A way to compact XML files, to reverse indenting
Post by sorin_ristache »
Hello,
Please post a sample XML fragment here on the forum or send a sample XML file for reproducing the problem using the Technical Support form.
Thank you,
Sorin
Please post a sample XML fragment here on the forum or send a sample XML file for reproducing the problem using the Technical Support form.
Thank you,
Sorin
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: A way to compact XML files, to reverse indenting
Dear Anayram,
Note that we had some technical problems and the sample you sent was not received.
Please send it to the following email address:
support@oxygenxml.com
There is another action that you may find useful to do the un-indent.
You can switch to the text page, select the XML content you want to normalize, right click, go to Source->Join and normalize
Regards,
Radu
Note that we had some technical problems and the sample you sent was not received.
Please send it to the following email address:
support@oxygenxml.com
There is another action that you may find useful to do the un-indent.
You can switch to the text page, select the XML content you want to normalize, right click, go to Source->Join and normalize
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 4
- Joined: Thu Nov 12, 2009 6:24 pm
Re: A way to compact XML files, to reverse indenting
Post by Michael_DC »
Dear Radu,
This did the trick for me! Thanks a lot!
Best,
Michael
This did the trick for me! Thanks a lot!
Best,
Michael
Return to “General XML Questions”
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