Remove specified tags
Having trouble installing Oxygen? Got a bug to report? Post it all here.
Remove specified tags
Hi Team,
I have below requirement please help me on this.
Say in web author i have selected below element.
<paratext>apple<bold>some<ital>some</ital></bold>ball</paratext>
<paratext>some text</paratex>
<paratext>some text<bold>some text</bold>some</paratext>
and when i put cursor in different location, from selected element paratext should get remove and below fragment should get insert.
apple<bold>some<ital>some<ital></bold>ball some text some text<bold>some text</bold>some
Thanks & Regards
Shilpa.P
I have below requirement please help me on this.
Say in web author i have selected below element.
<paratext>apple<bold>some<ital>some</ital></bold>ball</paratext>
<paratext>some text</paratex>
<paratext>some text<bold>some text</bold>some</paratext>
and when i put cursor in different location, from selected element paratext should get remove and below fragment should get insert.
apple<bold>some<ital>some<ital></bold>ball some text some text<bold>some text</bold>some
Thanks & Regards
Shilpa.P
Re: Remove specified tags
Hi,
The API that you can use to modify the document is ro.sync.ecss.extensions.api.AuthorDocumentController.
For your use case, you can use methods from AuthorDocumentController to:
- find all the nodes inside the selection: getNodesToSelect(int, int)
- create document fragments (from paratext nodes content for example, to be later inserted in the document): createDocumentFragment(int, int)
- delete nodes: deleteNode(AuthorNode)
- insert fragments: insertFragment(int, AuthorDocumentFragment)
These are just some examples of the methods that you can use. Please check the AuthorDocumentController documentation for more details.
Best Regards,
Mihaela
The API that you can use to modify the document is ro.sync.ecss.extensions.api.AuthorDocumentController.
For your use case, you can use methods from AuthorDocumentController to:
- find all the nodes inside the selection: getNodesToSelect(int, int)
- create document fragments (from paratext nodes content for example, to be later inserted in the document): createDocumentFragment(int, int)
- delete nodes: deleteNode(AuthorNode)
- insert fragments: insertFragment(int, AuthorDocumentFragment)
These are just some examples of the methods that you can use. Please check the AuthorDocumentController documentation for more details.
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: Remove specified tags
Hi Miheala,
After adding getNodesToSelect(int, int) in my code i am getting only one node(paratext)
Actually i should get 3 nodes(paratext,bold,ital)
<paratext>apple<bold>some<ital>some</ital></bold>ball</paratext>
Please let me know what is the behavior of getNodesToSelect(int, int)?
Thanks & Regards
Shilpa.P
After adding getNodesToSelect(int, int) in my code i am getting only one node(paratext)
Actually i should get 3 nodes(paratext,bold,ital)
<paratext>apple<bold>some<ital>some</ital></bold>ball</paratext>
Please let me know what is the behavior of getNodesToSelect(int, int)?
Thanks & Regards
Shilpa.P
Re: Remove specified tags
Hello,
The Author nodes model is similar with the DOM model. The result of the getNodesToSelect(int, int) method is a list of first-level nodes that are included between start and end offsets.
So, regarding your sample, the method will return the parent paratext node. To find the other nodes (bold and ital) you will have to get its child nodes. The API that you can use to find the content nodes of a node is: ro.sync.ecss.extensions.api.node.AuthorParentNode.getContentNodes() (note that you must check if the node is an AuthorParentNode first).
Best Regards,
Mihaela
The Author nodes model is similar with the DOM model. The result of the getNodesToSelect(int, int) method is a list of first-level nodes that are included between start and end offsets.
So, regarding your sample, the method will return the parent paratext node. To find the other nodes (bold and ital) you will have to get its child nodes. The API that you can use to find the content nodes of a node is: ro.sync.ecss.extensions.api.node.AuthorParentNode.getContentNodes() (note that you must check if the node is an AuthorParentNode first).
Best Regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service