OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Why many XML Editors don't preserve whitespace nodes

Dear list,

This question relates to yesterday's previous thread 'why whitespace
counts as a node'. Here, it was agreed that, so far as XML parsers are
concerned, whitespace within mixed content must be significant. Given
this, I'm interested in list members views on what an XML text editors
treatment of whitespace should ideally be like.

So, taking as an example, the following.

<new>this<b>is</b> <b>ok</b></new>
<b>this</b> <i>or</i> <b>this</b>

If I copy this into the XML text editors of three XML IDEs (the most
popular ones I know of that work on my OS), and then press the 'pretty
print' or 'indent' button, some or all of the the single space
character (&#x20;) whitespace nodes are replaced by the newline
character (&#x0A;) followed by padding spaces or tabs, to provide
indenting, I'll just include one example output here:


Is this what you would expect, is it desirable. is it even important?
I would prefer the following output which a plain text editor with XML
plugin provides:

      <new>this<b>is</b> <b>ok</b></new>
      <b>this</b> <i>or</i> <b>this</b>

[Note: I've looked at all the whitespace handling options for one of
these IDEs (there are quite a few!), and these options change how
whitespace is first treated either when XML is loaded or typed, but
not the behaviour of the 'pretty print' option]

Also, I like XML indenting, but why is it even necessary to use
padding characters in XML editors to achieve this, is this just legacy
text editor stuff? What's wrong with using appropriate line indents
that are associated with each newline character? Then, when typing in
the editor, each time I choose to insert a new line, the text cursor
shifts to the next line and appears indented as expected, but with no
preceding tab or space characters on that line.

This approach would allow copy and paste to work with indentation
being automatically resolved, indentation couldn't be wrecked by
deleting text, and it would also be easier to switch between XML
editors. Of course, you would still need a capability to remove all
those padding characters inserted by XML editors or XML serializers
with the 'indent' option set...


Phil Fearon

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS