Page 1 of 1

getParent() result on root node

Posted: Wed Jun 23, 2021 12:55 pm
by Isabelle
Hello,

I work with the version 22 of Oxygen SDK.

We have noticed this in the javadoc :
getParent
AuthorNode getParent()
Returns:
The AuthorNode representing the parent of this element, or null if this is the root element.
But we get the root element like this :

Code: Select all

AuthorNode rootNode = authorAccess.getDocumentController().getNodeAtOffset(authorAccess.getEditorAccess().getCaretOffset());
And then use the method getParent() on the rootNode; It provides an AuthorDocument and not null has expected.

Is it normal ?
Did we miss an information or the javadoc is not up to date ?

I have checked the release notes on your website (https://www.oxygenxml.com/xml_editor/whatisnew22.1.html) and i did not find any changes on that part.

Regards,
Isabelle

Re: getParent() result on root node

Posted: Wed Jun 23, 2021 1:28 pm
by Radu
Hi Isabelle,

The Javadoc is incorrect, I will rectify it like this:

Code: Select all

  /**
   * @return The {@link AuthorNode} representing the parent of this element, 
   * or <code>null</code> if this is the document node.
   */
  AuthorNode getParent();
The code has always worked this way, the root AuthorElement has a parent node which is an AuthorDocument node. The AuthorDocument node may also contain comments or processing instructions which are present before or after the root element.

Regards,
Radu