Re: [xml-dev] A proposal for simplify XML text editing and subsequent processing

From
Philip Fearon <>
To
Date
2011-08-21T13:30:49Z
ID
<>
Thread
Re: [xml-dev] A proposal for simplify XML text editing and subsequent processing
On Sun, Aug 21, 2011 at 3:28 AM, Liam R E Quin <> wrote:

>>  To complement this, editors should have a capability to
>> safely strip such indentation characters when encountered (the reverse
>> of what pretty-print formatters achieve) in external sources.
>
> You can only do that in general with a schema (e.g. a DTD or XSD schema)
> of course.

The indentation characters found in formatted XML, though often
inconsistent (as they often are in examples found online - even in W3C
documents - not a criticism just an observation), can still provide
some useful clues as to the true purpose of leading whitespace
characters.

A crude  example of how patterns in leading whitespace can provide
clues as to its purpose:

....<abc>
......<pre-x>
...Its evident that this block of text should have the
...............whitespace preserved because it's inconsistent
...with previous padding and the XML content
......</pre-x>
...</abc>

Granted, the trimming will never be 100% safe, but I would argue that,
without a schema or configuration settings, its possible to trim
leading whitespace characters much more safely than pretty-print (even
in the leading XML tools) inserts them.