XPath Editor

XML Editor


XMLQuire Logo

XMLQuire > V1.17

A new XML editing experience

XMLQuire Logo







Virtual Formatting

What's is Virtual Formatting?

Comparison of XMLQuire and normal XML Editors

The Virtual Formatting concept is quite simple and yet brings many benefits. XML text formatting appears the same in the XML Editor, but, instead of the padding characters inserted by ordinary editors, the left-margin adjusts automatically to the XML.

The screenshots (Right) might help: top-most is a screenshot of XML created in XMLQuire, and below it is a screenshot of the same XML after a conventional XML editor has had to add padding characters to format the XML conventionally.

The extra yellow highlights show the new padding characters added by other editors, such that they're indistinguishable (check out the 'books' title in the XML text) from real XML content, these non-printable characters also add to a kind of 'editing latency'.

Hasn't it been done before?

Apparently not, but once you realize the benefits this is quite surprising. As this is a new concept there's no recognised term for it, but 'Virtual Formatting' fits quite nicely. It's hard to say why this hasn't been done before, possibly because many XML editors are actually code editors first with XML features added later. XMLQuire is designed to demonstrate that this technology is effective in a real work environment, it's much more than a proof of concept.

What if I'm importing whitespace indented XML?

This will be the typical case until more Virtual Formatting editors surface. XMLQuire first checks XML for signs of formatting, like regular patterns in leading whitespace. If found, these patterns are actually exploited to help ensure that the XML is trimmed safely, without removing significant whitespace. Conventional editors do the reverse (insert formatting characters), but without the benefit of any patterns, they are therefore much more prone to modifying whitespace where it should be preserved.

What happens to XML imported with no XML formatting line-feeds?

If XMLQuire detects no line-feeds after several element nodes have been parsed, it will insert line-feeds to assist readability. Line-feeds are not inserted in mixed-content, where xml:space preserve values are in scope, or for certain vocabularies' elements which are known to treat whitespace as significant, such as html:pre and xsl:text.

What are the Benefits?

There are too many to list fully here - but here are some highlights:

  • Integrity of leading whitespace of XML is always maintained
  • Users aren't distracted or misled by poorly formatted XML
  • No more time spent in correcting formatting or reformatting
  • There's no delay in reformatting XML, it can be updated continuously
  • XML can be word-wrapped and indentation is still maintained
  • Word-wrap on screen keeps text in view and reduces screen width taken up
  • For printing, word-wrap fits the XML to margins, whilst keeping indentation
  • Drag and drop operations just work, with the XML reflowing to the new structure
  • Proportional fonts can be used and indentation will still align properly
  • Differencing and merge tools no longer confused by differences in whitespace
  • Improved interoperability between users because formatting styles don't affect text content
  • Improved interoperability between different tools
  • Indentation of new lines for attribute names and values fully supported
  • File size is approximately 25% smaller for Virtually Formatted XML
  • Formatting improves accurate indication of non-balanced XML tags
  • Element cursor linking open/close tags vertically can follow in from the left-margin
  • Line numbers can follow the XML indentation, in print or on screen
  • No more arguments over tabs or spaces - its neither!
  • For XSLT, measures to prevent indent characters being added to the result tree are not needed
  • XSLT becomes more readable and maintainable
  • XML tags embedded within XML comments can still be formatted properly
  • Indentation can be adjusted to suit available space, preferences
  • View can be left-justified to provide a better view when editing leading whitespace in XML Text