Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Parsing XML in execute script service

Avatar

Former Community Member
I have a XML type variable in my process which is supplied from front end .NET application. I want to catch that XML variable in execute script service window and add two new nodes of the same existing type in that XML. How is that possible? which getProcessData method I should use to access that variable in execute script and then how do I append childs in that XML. Please help. Thanks!
5 Replies

Avatar

Former Community Member
String FeedBackFor = patExecContext.getProcessDataStringValue("/process_data/@FeedbackForCN");

where FeedbackForCN is the name of a process variable

hope this helps

Avatar

Level 9
I think you could probably do this completely with SetValue.

- get the current value of the node, and serialize it (to turn it into a string)

- manipulate the string, add your extra nodes to it.

- then deserialize the string, and assign it back to its parent node.



Haven't tried it, but it should work.



Howard

http://www.avoka.com

Avatar

Level 8
Level 8
Hi,



I have tried with:



String FeedBackFor = patExecContext.getProcessDataStringValue("/process_data/@FeedbackForCN") in my executescript-service, but nothing is stored in my FeedBackFor variable.



Just before invoking the executescript I check the variable with the logger and it shows that the variable contains the XML it should.



What could I be doing wrong?



Sincerely

Kim Christensen

Avatar

Level 10
What is the variable type for FeedbackForCN?



If it's xml then your xPath needs to be /process_data/FeedbackForCN (no @ sign)



Jasmin

Avatar

Former Community Member
If you really want to use the execute script service, you can always use the getProcessDataValue(xpath) or getProcessDataValueByVariableName(variableName) methods...they both return Object objects, which you cast to the appropriate data type.



The methods of the patExecContext class are now documented here:



http://kb.adobe.com/selfservice/viewContent.do?externalId=kb402587&sliceId=1



scott