How to get nodes xpath
Posted: Wed Dec 14, 2022 11:29 am
Hi Team,
Below is the example where i need xpath of para node including its parents.
Ex ;
<footnote>
<footnote.body>
<para> Testing the xpath
</para>
</footnote.body>
</footnote>
in the above xml say i have clicked in para so now i need the path where my cursor placed. Below is the result which i need. Please let me know how to achieve this using javasript.
//footnote/footnote.body/para
Using below code i am getting tag name where my cursor placed like para but i want whole parent xpath as well.
let selection = jaEditor.getSelectionManager().getSelection();
let tagName = selection.getNodeAtSelection().getNodeName();
Below is the example where i need xpath of para node including its parents.
Ex ;
<footnote>
<footnote.body>
<para> Testing the xpath
</para>
</footnote.body>
</footnote>
in the above xml say i have clicked in para so now i need the path where my cursor placed. Below is the result which i need. Please let me know how to achieve this using javasript.
//footnote/footnote.body/para
Using below code i am getting tag name where my cursor placed like para but i want whole parent xpath as well.
let selection = jaEditor.getSelectionManager().getSelection();
let tagName = selection.getNodeAtSelection().getNodeName();