[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
> 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 it. > > 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] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|