[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] 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. <abc> <new>this<b>is</b> <b>ok</b></new> <b>this</b> <i>or</i> <b>this</b> </abc> 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 ( ) whitespace nodes are replaced by the newline character (
) followed by padding spaces or tabs, to provide indenting, I'll just include one example output here: <abc>\n <new>this<b>is</b>\n <b>ok</b></new>\n <b>this</b>\n <i>or</i>\n <b>this</b>\n </abc> 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: <abc> <new>this<b>is</b> <b>ok</b></new> <b>this</b> <i>or</i> <b>this</b> </abc> [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... Thanks Phil Fearon http://qutoric.com [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
|