Page 1 of 1
Action for changing multiple elements at once
Posted: Fri Aug 01, 2014 5:51 pm
by Frank Ralf
Hi,
I'm working on an action to remove all "status" attributes from a topic using the
ChangeAttributeOperation (see also
"How to toggle attribute values?".) However, I haven't figured out yet how to make the action work for multiple elements at the same time.
Is this a matter of the correct XPath expression or do I have to use some kind of loop construction? (If yes, how?)
TIA
Frank
Re: Action for changing multiple elements at once
Posted: Fri Aug 01, 2014 5:58 pm
by Frank Ralf
I've already found
"Editing multiple AuthorNodes at once" which suggests that this might have to be solved on the underlying Java level.
Frank
Re: Action for changing multiple elements at once
Posted: Mon Aug 04, 2014 11:40 am
by alex_jitianu
Hello Frank,
ChangeAttributeOperation has an argument named
elementLocation. Its value is an XPath expression that identifies the element to process. Unfortunately for you use case,
ChangeAttributeOperation processes only one element (so even if you use an XPath expression that identifies multiple elements, only the first one is removed).
Using our JAVA based API you can create a custom change attribute operation.
ChangeAttributeOperation can consist in a very good starting point. It already executes the XPath and identifies the nodes. All you have to do is iterate over all of them instead of just processing 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, inside folder
samples/Oxygen Default Frameworks you will find the source code for
ChangeAttributeOperation.
Best regards,
Alex
Re: Action for changing multiple elements at once
Posted: Tue Aug 05, 2014 11:04 am
by Frank Ralf
Hi Alex,
Many thanks for the explanation and for pointing me in the right direction!
Kind regards,
Frank