Find out nodes

Having trouble installing Oxygen? Got a bug to report? Post it all here.
shilpa
Posts: 66
Joined: Mon Jul 04, 2022 8:42 am

Find out nodes

Post by shilpa »

Hi Team,
I would like to know how to get below result
How to check the node X is child node Y ?
How to check the node X is immediate child of node Y?
How to check X is the same node of Y?
How to check ancestor node of X?
How to get node using start offset and end offset?

Thanks & Regards
Shilpa.P
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Find out nodes

Post by mihaela »

Hello,

I think you are referring to the SDK-API, even if you posted inside the "Common Problems" section. Please post further questions related to the SDK inside the SDK-API, Frameworks - Document Types category. Thank you!

By "node" I think you are referring to an ro.sync.ecss.extensions.api.node.AuthorNode so you have to know that there is a ro.sync.ecss.extensions.api.node.AuthorNode.getParent() method can be used to find its parent node.

To find the child nodes you first have to check if the AuthorNode is an ro.sync.ecss.extensions.api.node.AuthorParentNode and then use the ro.sync.ecss.extensions.api.node.AuthorParentNode.getContentNodes() method.

These two methods that I mentioned will help you check the relationship between nodes.
If you work with offsets and you want to find some nodes in the content you have to check the ro.sync.ecss.extensions.api.AuthorDocumentController and ro.sync.ecss.extensions.api.access.AuthorEditorAccess API. Methods like ro.sync.ecss.extensions.api.AuthorDocumentController.getNodeAtOffset(int) or ro.sync.exml.workspace.api.editor.page.author.WSAuthorEditorPageBase.getFullySelectedNode(int, int) can be used to obtain nodes from the document. These are just some examples, if you need API for other specific use cases and you don't find it, please let us know.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
Post Reply