Pointer Off Side When Inserting an Element
Posted: Mon Mar 07, 2011 9:33 pm
Hi all,
I just created a java class, that can insert certain kinds of tags into a particular document type.
Now everything works perfectly except for when I insert this into a particular position. For example, the original xml file looks like:
<p><i> Text </i></p>
and I switch to the author mode, and I put my cursor after <P> but before <i> and insert the element. Ideally, the element inserted should reside between <p> and <i>, however, after insertion,the element will always be after the <i> instead of <p>.
This seems to be a small problem, but I've re-checked my Java class, and the only thing that may relate to this problem is the following code:
int caretPosition = authorAccess.getCaretOffset();
authorAccess.insertXMLFragment(mediaXML, caretPosition);
which looks correct to me.
So I would be grateful if anyone could help me debug. Thanks in advance!
I just created a java class, that can insert certain kinds of tags into a particular document type.
Now everything works perfectly except for when I insert this into a particular position. For example, the original xml file looks like:
<p><i> Text </i></p>
and I switch to the author mode, and I put my cursor after <P> but before <i> and insert the element. Ideally, the element inserted should reside between <p> and <i>, however, after insertion,the element will always be after the <i> instead of <p>.
This seems to be a small problem, but I've re-checked my Java class, and the only thing that may relate to this problem is the following code:
int caretPosition = authorAccess.getCaretOffset();
authorAccess.insertXMLFragment(mediaXML, caretPosition);
which looks correct to me.
So I would be grateful if anyone could help me debug. Thanks in advance!