Reputation: 4449
Background
With UltraEdit you have the option to properly format XML content:
View > View as (Highlighting file type) > XML
Which changes the coloring so that tags, attributes and content are better readable.
Then you can do:
Format > XML Convert to CR/LFs
So that line breaks are appropriately applied.
What I need
What I am missing is proper indentation. You can collapse/expand segments, but without proper indentation it's hard to see the underlying structure.
Question
How can I apply proper indentation to the XML content?
Upvotes: 1
Views: 14088
Reputation: 61
The easiest way and built-in Ultraedit since version v17
Format -> XML Convert to CR/LFs
Upvotes: 0
Reputation: 71
Use the XML Tag under Coding section to get the proper indention of XML file. Then select the "Reformat XML" to get the beautiful formatting option.
Upvotes: 7
Reputation: 26
The only answer I've found to this is to use Notepad ++ with the XML Tools plugin. Does exactly what you've described and more with a few simple clicks.
Upvotes: 1
Reputation: 49097
Availability of XML Convert to CR/LFs in UE for Windows < v17.10 and UES < v11.10
The command XML Convert to CR/LFs is only available if the active file is syntax highlighted with a syntax highlighting language containing in the wordfile in first line the language marker XML_LANG.
Availability of XML Convert to CR/LFs in UE for Windows >= v17.10 and UES >= v11.10
The command XML Convert to CR/LFs is available for any file.
The user must be aware of not using this command on files which have no XML structure.
Indent settings for re-indentation
Re-indentation of the lines depends on Word Wrap/Tab Settings as defined in Settings respectively Configuration on ribbon Advanced respectively in menu Advanced.
The indents depend on the settings:
whereby Indent spaces is only taken into account if Use spaces in place of tabs is checked as otherwise indentation is done with horizontal tabs and not with spaces.
Word Wrap/Tab Settings configuration dialog has at top a drop down list. All settings below are set for the file extensions specified for the currently selected list item at top.
Default is the list item for new files not yet saved, all files without file extension and all files with a file extension not defined in this configuration dialog.
File extensions list items can be added with a click on button Change List, entering 1 or more file extensions (case-insensitive interpreted, enter only in lower case) separated by a space and without point, for example just xml xsd
and NOT .xml .xsd
, clicking on the buttons Add and OK.
For more details see file extension based word wrap, tab and indent settings in UltraEdit forum about Configuration/INI Settings.
Syntax highlighting for new files and files with no or unknown extension
By opening Advanced - Settings/Configuration - Editor Display - Syntax Highlighting, selecting the (preferred) syntax highlighting language for XML files (multiple different defined XML wordfiles are possible), clicking on button Open and clicking on button Cancel, the appropriate wordfile can be opened in UltraEdit for editing.
At end of the last line the file extensions are specified for those files on which this syntax highlighting language should be automatically applied after opening. File extensions without point can be added here. The file extensions are usually defined in the wordfile in upper case, but again the file extensions are interpreted case-insensitive.
The Syntax Highlighting configuration dialog has also the setting Highlight new files as with a list box to choose one of the installed syntax highlighting languages to use by default for new, unsaved files, but not for named files without a file extension.
One of the syntax highlighting languages in the user's wordfiles directory can be set as language to be applied on any file for which no other language could be found by UltraEdit according to file extensions and file names specifications in the wordfiles. This is done by appending at end of first line of a wordfile an asterisk. See chapter 5.4 Specifying a default language for all unknown files in Readme for the Syntax Highlighting forum for details in IDM Computer Solutions, Inc. forums.
And with UltraEdit for Windows v19.00 automatic XML syntax highlighting was introduced for all files having an XML declaration at top, i.e. there is <?xml
at top of the file (and no whitespace although XML specification declares whitespaces as acceptable at beginning of an XML file).
Conclusion
See also Script to reformat a not well formatted XML block pasted into a new file in UltraEdit's Scripts forum for even more details and a simple reformat by a single hotkey press solution using an UltraEdit/UEStudio script.
Upvotes: 2