Pretty printing FrameMaker’s XML
December 17th, 2004
XML produces functional, but very ugly, XML.
I've had a look today for ways to remedy this. The reason for doing this is that the XML may need to be edited in its raw state occasionally, and this would be much easier if it was indented to display the element hierarchy.
I tried:
- Tidy and TidyUI - but these didn't recognize entities such as / and just deleted them. TidyUI also removed spacing from within a literallayout element, which is just plain dumb
- xmllint and xsltlint - but in researching possible tools I read warnings about xmllint and so I wasn't confident about using them
- xmlformat - I had most success with this. I tried the Perl version, which worked fine from a DOS command console in Windows. It produced nicely formatted XML, without the problems TidyUI had, but on import into FrameMaker, some of the formatting spaces showed up in the FrameMaker text (e.g. as spacing to the left of subheadings)
I suppose the solution, if you really wanted to do this, would be to format the XML with xmlformat, work on the formatted XML, then remove the formatting before opening the file in FrameMaker. xmlformat allows you to create a configuration file specifying how you want to format the XML, which would allow you to have a "prettyprinted" config file and a "noformatting" config file to remove the spacing.
One of the things I like about xmlformat is that it appears to be very well documented.
Get xmlformat from:
http://www.kitebird.com/software/xmlformat/
Potentially similar posts
- My first (useful) Ruby program – June 2011
- Viewing dynamically generated HTML in the HTML Help viewer – November 2010
- EasyListener resurrected – June 2010
- Downloads – October 2007
- Problems with Flare 2.0 – January 2007