Selected text from Author to xmlfragment
Posted: Wed Sep 23, 2015 1:55 pm
Hello,
I have a problem with the selected text after the serialization.
I use for that:
I have the selection from the original xml like:
After the serializeFragmentToXML the text will be:
String selectionAsXML -> "<container>[space]<format>text</format>[space]</container>"
I have [space] in the text. That isn't correct for me because I want make some changes on text.
How can I get the serialized text like the original text selected without spaces, like ?
String selectionAsXML -> "<container><format>text</format></container>"
Thanks!
Calin
I have a problem with the selected text after the serialization.
I use for that:
Code: Select all
if(authorAccess.getEditorAccess().hasSelection()) {
AuthorDocumentController documentController = authorAccess.getDocumentController();
AuthorDocumentFragment selectionAsAFragment = documentController.createDocumentFragment(
authorAccess.getEditorAccess().getSelectionStart(), authorAccess.getEditorAccess().getSelectionEnd());
String selectionAsXML = documentController.serializeFragmentToXML(selectionAsAFragment);
//Deletes the selection
authorAccess.getEditorAccess().deleteSelection();
//Process the selectionAsXML fragment, modify it.
//................
//Insert the XML fragment back at caret position.
documentController.insertXMLFragment(selectionAsXML, authorAccess.getEditorAccess().getCaretOffset());
}
Code: Select all
<container>
<format>text</format>
</container>
String selectionAsXML -> "<container>[space]<format>text</format>[space]</container>"
I have [space] in the text. That isn't correct for me because I want make some changes on text.
How can I get the serialized text like the original text selected without spaces, like ?
String selectionAsXML -> "<container><format>text</format></container>"
Thanks!
Calin