cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript Task that uses XPath

agreen53
Champ in-the-making
Champ in-the-making
I am running out of options and attempting to find out if there is a way to evaluate xpath expressions inside of a ScriptTask. 

Long story short, I have to embed a large XML block in the process definition, and use several variables to access the appropriate value inside of the XML.  The problem I am running into is that document.evaluate is not an option and that is the primary suggestion online for evaluating xml and xpath expressions with javascript.  I don't have access to any other scripting languages at this time.  Organizational standards won't allow it without a very good reason.
2 REPLIES 2

vasile_dirla
Star Contributor
Star Contributor
Hi,
Do you have any reason to use ScriptTask and not ServiceTask ? (I think that a service task will help a lot here)

if if still want to use ScriptTask (javascript) then you can consider calling java code from your javascript task Smiley Happy
you can use: javax.xml.xpath

agreen53
Champ in-the-making
Champ in-the-making
I was easily able to complete this via a service task.  I had code to do this already. 

However I was attempting a proof of concept where an editor could generate a script task to retrieve a value from a block of xml via xpath search without developing a delegate and using only javascript.  All my attempts to accomplish this task failed due lack of access to libraries, and lack of knowledge on javascript.  I was unaware that I could call out java libraries in javascript.

One thing that I didn't try was to see if jQuery was available to javascript tasks.  That probably would have been another method that would ease things.