I'm adding a new paragraph (P) to a body (B). Later I need to go get that paragraph because I am inserting another paragraph after it, but before the next paragraph. So finding it's position int he parent is key.
However, for newly added content it appears there is no parent? Simple code as follows results in "NULL" being returned from newParagraph.getParent():
(in this example I have retreived paragraph - an instance of P - via some traversing.
- Code: Select all
Body b= (Body)paragraph.getParent();
P newParagraph = new P();
//do a bunch of stuff and lose position of newParagraph (many new paragraphs added in the real code)
Body b=(Body)newParagraph.getParent(); //This results in NULL