Hi,
I'd like to add some clearer specification to the code posted above:
http://forum.pspad.com/read.php?2,66273#msg-66284

It changes the whole content of the editor window with the sorted text - it is
probably ok for the given sample text which only contains the XML elements, that
should be sorted;
however, it is likely, that a whole XML file will be loaded, with other
elements, or at least with the toplevel element etc., where sorting would be
harmful.
It might be appropriate to work with the selected text only.
The code above can be modified to work with the selected text only
cite:
--------------------------------------------------------------------------------
var inputTxt = 
actEd.text();--------------------------------------------------------------------------------

should be changed to:
cite:
--------------------------------------------------------------------------------
var inputTxt = 
actEd.selText();--------------------------------------------------------------------------------


and in the same way
cite:
--------------------------------------------------------------------------------
actEd.text(outputTxt);--------------------------------------------------------------------------------

to:
cite:
--------------------------------------------------------------------------------
actEd.selText(outputText);--------------------------------------------------------------------------------


Of course, there can be variants to check for a possibly present selection and
handle it conditionally - depending on the requirements.
hth,
   vbr

-- 
<http://forum.pspad.com/read.php?2,66273,66286>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem