[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: A proposal for simplify XML text editing and subsequent pr

  • From: Philip Fearon <pgfearo@googlemail.com>
  • To: xml-dev@lists.xml.org
  • Date: Sun, 21 Aug 2011 08:35:58 +0100

Re:  A proposal for simplify XML text editing and subsequent pr
> Seems a reasonable approach for a GUI for new data.

Depending on your precise definition for a GUI, perhaps this proposal
could still work in predominantly keyboard-driven text-only interfaces
(hopefully it's Ok to mention emacs and vi)? For such text-only tools
where there's no adjustable left-margin as such, I would hope it's
possible to emulate this behavior using padding characters but
tracking them continuously as they're inserted by the tool and
protecting them so that they can be stripped safely (knowing that the
user didn't type these characters) when the XML is saved, so to all
intents and purposes they never existed. I haven't tried this, and I'm
far from certain that users of this type of tool would even welcome

> What about XML that was already indented? You couldn't strip out the
> indenting text (unlress you had some awarenesss of the structure, such as a
> schema) so you would get double indents or mixed indents?  Or does the
> editor operate line-by line to know which lines are diplayed indented and
> which use the incoming XML whitespace indentation?

The latter. The editor should operate line-by-line to assess whether
the whitespace is indentation or significant content. The indentation
characters on preceding lines, combined with the current XML context
are normally sufficient to provide a reasonable assessment as to what
leading whitespace can be safely removed, even without a schema.
Consider also that, without a schema, pretty-print features in
existing tools, which insert indentation characters into non-formatted
XML, don't have the luxury of the 'information' that padding
characters themselves provide.

The approach I've taken initially only scans the first few lines
following the document element (ignoring comments etc.), to check
whether padding characters have been used. If it's established that
the XML is 'clean' of padding then no further attempts are made to
trim whitespace that appears to be padding further into the document,
reducing what is already a small error risk to nil. Options exist to
force extra trimming for selected text later on, after the XML is
loaded. All text pasted or dropped into the XML editor from an
external source is also treated in this way, text from internal
clipboard operations isn't touched, except for leading and trailing
line-feeds, which may be trimmed if there are already line-feeds at
the target position.

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


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.