[oXygen-user] Format & Indent multiple files?
Oxygen XML Editor Support (Adrian Buza)
Mon Nov 24 09:25:45 CST 2014
We do have a request logged on our issue tracking tool for a batch
"Format and Indent" action (in the Project view). I added your vote and
gave it a nudge.
If you have a reasonable number of files that you want to apply this to,
you could use a workaround:
1. Enable in Options > Preferences, Editor > Format, the option "Format
and indent the document on open"
2. Set the format and indent options you want in Editor > Format and
Editor > Format > XML preference panels
3. Close all files.
4. From the Project view open a batch of files you want to format (20-30
at a time, more if they are very small). Right click on selection and
from contextual menu pick 'Open All Files'.
5. Look at a few files if the formatting looks right to you.
6. File > 'Save All' files.
7. Repeat from step 3 until all files are formatted.
8. Disable the option "Format and indent the document on open" from step 1.
9. If Oxygen slows down significantly or runs out of memory while
opening the files, it means you gave it a batch larger than it could
handle. If that happens, close all the files without saving and restart
Oxygen. Try again with a smaller batch.
I guess you could also use a batch transformation in Oxygen (on a folder
or a set of files) and use the Saxon formatting options. You can use a
copy stylesheet similar to the one found in the Oxygen samples,
Although I must point out that DOCTYPEs will be lost and entity
references will be expanded (replaced with the referred entity value)
when you apply a transformation.
Oxygen applies the transformation scenario in turn for each file from
the selected files and folders from the Project view. Note that you have
to configure the transformation scenario to transform one XML file and
output it to another file (you can't output to the same file as the
input file), so the output file must either have a different name or be
located in a different folder. Either way, an output file name (not
folder name) must be provided in the Output tab of the transformation
scenario. You can use editor variables (macros) to refer the filename an
folder path of the source file.
If you use the Saxon-HE/PE/EE transformer engine, I would also recommend
disabling the option "Expand attribute defaults" (default enabled) from
the "Advanced options" (cogwheel button to the right of the transformer
combo). By default this is enabled and causes default values of
attributes specified in the DTD/schema to appear in the XML model and as
a result also the copied output.
oXygen XML Editor and Author Support
Tel: +1-650-352-1250 ext.2020
On 22.11.2014 20:00, Roger Sheen wrote:
> I know this has been requested before, so I’m curious to hear whether
> a future oXygen version might include the ability to Format & Indent
> multiple files at once--perhaps via a context menu item in Project View?
> Until then, I’m looking for a way to batch format & indent multiple
> files & limit line width to a maximum value. It seems `xmllint
> --format` doesn’t provide a line width option.
> The context menu in Project View suggests I could apply a
> transformation scenario to a folder. Could this be used to achieve the
> same result, perhaps through some use of the saxon:line-length and
> saxon:indent-spaces options?
> Or is there a command I could run on the command line that would
> approximate the results of oXygen’s Format & Indent feature?
> oXygen-user mailing list
More information about the oXygen-user