Get Full tag

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

Get Full tag

Post by shilpa »

Hi Team,
In my code i am getting nodes by FindNodesByXpath("/headtext");
Here i am not getting full tag attributes instead i am getting <headtext align="center" ,> (337, 349).
I need entire tags and attributes with values. Example is given below.
Please do the needful.

Example :
<headtext align="centre">Syllabus<headtext>
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Get Full tag

Post by mihaela »

Hello,

Can you please give us more details about the code you are referring to and what you are trying to obtain?

Do you use the AuthorDocumentController.findNodesByXPath(String, boolean, boolean, boolean) API?
If this is the case, the result is a list of AuthorNodes that contain information about the start and end offsets of the node (see AuthorNode.getStartOffset() and AuthorNode.getEndOffset() methods).

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
shilpa
Posts: 66
Joined: Mon Jul 04, 2022 8:42 am

Re: Get Full tag

Post by shilpa »

Hi Mihaela,

Thank you for the response. Yes i use AuthorDocumentController.findNodesByXPath(String, boolean, boolean, boolean) and the result is a list of AuthorNodes.
My requirement is to display the node. So when i iterate the list and display the data i am getting node as <headtext align="center" ,> (337, 349).
But i need node as <headtext align="centre">xyz<headtext>.
My question is how to get full node like <headtext align="centre">xyz<headtext>.
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Get Full tag

Post by mihaela »

Hello,

The API that you need to obtain the XML representation of an AuthorNode is:
  1. AuthorDocumentController.createDocumentFragment(AuthorNode, boolean) to obtain the AuthorDocumentFragment corresponding to the node
  2. AuthorDocumentController.serializeFragmentToXML(AuthorDocumentFragment) to obtain the XML text corresponding to a given AuthorDocumentFragment.

Please let us know if you need more information.

Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
shilpa
Posts: 66
Joined: Mon Jul 04, 2022 8:42 am

Re: Get Full tag

Post by shilpa »

Now i am able to see xml full tag now. Thank you so much for the help Mihaela.
mihaela
Posts: 490
Joined: Wed May 20, 2009 2:40 pm

Re: Get Full tag

Post by mihaela »

Hi,

We are happy that we helped you.
Please let us know if you need further assistance.

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