Thanks for pinpointing the problem.
We'll fix this odd behavior, at least for the simplest form of text
selection (with or without a DTD, of course), in next release.
Manuel Collado wrote:
> I'm using XML comments to annotate documents with diagnostic messages
> generated by external tools. These messages can be nicely displayed in
> XEE. I love this capability very much. XXE is certainly a great product!
>
> In doing so, I've discovered a strange behaviour of text replacement. It
> has beed detected in xxe-std-26. Upgrading to xxe-st-26p1 doesn't help.
>
> In some cases, selecting the whole text of a text node and typing some
> characters to replace it let the new text go to either the preceding
> node of the following one, depending on the document structure and DTD
> restrictions.
>
> This effect shows up mainly in documents not restricted by a DTD. But
> also if a DTD requires that the node must have character contents and
> the replaced text is near a XML comment.
>
> Please find attached minimal sample files to test the above:
>
> - open either xcomment1.xml or xcomment2.xml in XXE
> - double click on some numeric value
> - type a new value to replace it
>
> Please check every item. The behaviour is different in each case. The
> most surprising case is when replacing the value marked 'out of range'
> in xcomment2.xml. The new typed value is inserted in front of the
> comment text, and an empty text node appears after the comment.
>
>
> Now my guessings:
>
> It seems that selected text replacement is done in two separate steps:
> - deleting the selected text, and
> - inserting the new typed text
>
> The first action is done somehow 'intelligently' by XXE. If the text
> node becomes empty, it is discarded, and the caret is repositioned in a
> neighbour node.
>
> If this is the case, an obvious solution would be to take into account
> if the goal of the deletion is to replace the text, and avoid to discard
> the node containing the caret, but keep it as an empty text node.
>
> This would apply also when the selected text span several nodes (only
> one holds the caret).
>
> Hope this helps,
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?xml-stylesheet type="text/css" href="xcomment.css"?>
> <data>
> <value>9</value>
> <value>25<!-- value out of range --></value>
> <value>6</value>
> </data>
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <?xml-stylesheet type="text/css" href="xcomment.css"?>
> <!DOCTYPE data SYSTEM "xcomment.dtd">
> <data>
> <value>9</value>
> <value>25<!-- value out of range --></value>
> <value>6</value>
> </data>
>
>
> ------------------------------------------------------------------------
>
> * {
> display: block;
> }
>
> value:before {
> content: " ";
> }
>
> *:comment {
> display: inline;
> background-color: #ff9;
> border-style: solid;
> border-width: medium;
> border-color: #fff;
> }
>
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!ELEMENT data ( value* ) >
> <!ELEMENT value ( #PCDATA )>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
>
> --
> XMLmind XML Editor Support List
> xmleditor-support at xmlmind.com
> http://www.xmlmind.com/mailman/listinfo/xmleditor-support
--
Hussein SHAFIE, hussein at pixware.fr,
Pixware, Immeuble Capricorne, 23 rue Colbert,
78180 Montigny Le Bretonneux, France,
Phone: +33 (0)1 30 60 07 00, Fax: +33 (0)1 30 96 05 23