DeleteElementOperation
Oxygen general issues.
-
- Posts: 3
- Joined: Wed May 07, 2014 7:17 pm
DeleteElementOperation
Currently using XML Editor 15.2, build 2014040317.
Wanting to remove all elements of a certain name within an action operation. Was looking at creating author action using the DeleteElementOperation. I set the invoke the operation to ro.sync.ecss.extensions.commons.operations.DeleteElementOperation, however you cannot create any arguments. In looking at some oxygen samples the travel guide (Sample) the DeleteElementOperation is in there and there is an argument option. How do you get the arguments inserted?
Is there a better way of accomplishing element removal. We use empty elements to show start and stop of revision indication. When starting a new revision the old element tags are removed and wanted to add a button on my menu for users to select that would remove the elements. Can accomplish via xsl and adding to external tools but want on the same menu as other actions.
Regards,
Keith
Wanting to remove all elements of a certain name within an action operation. Was looking at creating author action using the DeleteElementOperation. I set the invoke the operation to ro.sync.ecss.extensions.commons.operations.DeleteElementOperation, however you cannot create any arguments. In looking at some oxygen samples the travel guide (Sample) the DeleteElementOperation is in there and there is an argument option. How do you get the arguments inserted?
Is there a better way of accomplishing element removal. We use empty elements to show start and stop of revision indication. When starting a new revision the old element tags are removed and wanted to add a button on my menu for users to select that would remove the elements. Can accomplish via xsl and adding to external tools but want on the same menu as other actions.
Regards,
Keith
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: DeleteElementOperation
Post by alex_jitianu »
Hi Keith,
After you've chosen the DeleteElementOperation, just below it, at the section "with these arguments", you should see the elementLocation argument. Its value is an XPath expression that identifies the element. Unfortunately for you use case, DeleteElementOperation can only delete one element (so even if you use an XPath expression that identifies multiple elements, only the first one is removed).
Here are some possible solutions:
1. Using our JAVA based API you can create a custom delete operation. DeleteElementOperation can consist in a very good starting point. It already executes the XPath, identifies the nodes, all you have to do is just delete them all instead of just the first one. We have a tutorial on Author Framework Development. There is also a topic on How to Add a Custom Operation (please take notice that this topic has links to the v16.0 SDK which uses Maven). Once you create the start-up project, you will find inside folder *samples/Oxygen Default Frameworks* the source code for DeleteElementOperation.
2. You can use an XSLTOperation. You can use a stylesheet that processes the document and return a copy without those empty elements skipped. Might be a easier solution if you are unwilling to go into the JAVA API but depending on the size of the element being processed might be more performance and memory consuming.
I will also add an issue for us to implement an operation that can delete multiple nodes. Basically what I've recommended you to do at 1.
Best regards,
Alex
After you've chosen the DeleteElementOperation, just below it, at the section "with these arguments", you should see the elementLocation argument. Its value is an XPath expression that identifies the element. Unfortunately for you use case, DeleteElementOperation can only delete one element (so even if you use an XPath expression that identifies multiple elements, only the first one is removed).
Here are some possible solutions:
1. Using our JAVA based API you can create a custom delete operation. DeleteElementOperation can consist in a very good starting point. It already executes the XPath, identifies the nodes, all you have to do is just delete them all instead of just the first one. We have a tutorial on Author Framework Development. There is also a topic on How to Add a Custom Operation (please take notice that this topic has links to the v16.0 SDK which uses Maven). Once you create the start-up project, you will find inside folder *samples/Oxygen Default Frameworks* the source code for DeleteElementOperation.
2. You can use an XSLTOperation. You can use a stylesheet that processes the document and return a copy without those empty elements skipped. Might be a easier solution if you are unwilling to go into the JAVA API but depending on the size of the element being processed might be more performance and memory consuming.
I will also add an issue for us to implement an operation that can delete multiple nodes. Basically what I've recommended you to do at 1.
Best regards,
Alex
-
- Posts: 9413
- Joined: Fri Jul 09, 2004 5:18 pm
Re: DeleteElementOperation
Hi,
Oxygen 16.1 was just released and it contains a new operation called ro.sync.ecss.extensions.commons.operations.DeleteElementsOperation which can be used to delete multiple elements specified by an XPath expression.
Regards,
Radu
Oxygen 16.1 was just released and it contains a new operation called ro.sync.ecss.extensions.commons.operations.DeleteElementsOperation which can be used to delete multiple elements specified by an XPath expression.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
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