This discussion is archived
5 Replies Latest reply: Nov 19, 2012 1:11 PM by Rudy Meyer RSS

Error in parseXML() when data contains "&"

Rudy Meyer Newbie
Currently Being Moderated
Hello,

I have a Subprocess that is a Loop type. I am calling a web service within the loop. The data is pulled using a database adapter. One of the data values I am passing to the service is "Furniture & amp; Office Equipment" (title). Ignore the space between the & and amp;, I did that so it posts properly. The input data association is using this XPath Expression:

oraext:parseXML(concat("<CreateCostCodes xmlns:v1='http://xmlns.oracle.com/Primavera/CM/WS/Cost/V1'>
<v1:CostCode>
<v1:ProjectName>", bpmn:getDataObject('inputData')/ns2:projectName, "</v1:ProjectName>
<v1:CostCode>", bpmn:getDataObject('costCodes')/ns:costCodes[bpmn:getActivityInstanceAttribute('SUBPROCESS5114801681331', 'loopCounter')]/ns1:costCode, "</v1:CostCode>
<v1:Title>", bpmn:getDataObject('costCodes')/ns:costCodes[bpmn:getActivityInstanceAttribute('SUBPROCESS5114801681331', 'loopCounter')]/ns1:title, "</v1:Title>
</v1:CostCode>
</CreateCostCodes>"))

My process is failing when it hits the data containing the title that has the & amp; in it. Can someone suggest how to properly parse this?

Thank you
Rudy
  • 1. Re: Error in parseXML() when data contains "&"
    vladodias Guru
    Currently Being Moderated
    My process is failing when it hits the data containing the title that has the & amp; in it.
    That's one of the reasons we should never use string concatenation to create xml representations...

    Use a XSLT transformation instead...

    Cheers,
    Vlad
  • 2. Re: Error in parseXML() when data contains "&"
    Rudy Meyer Newbie
    Currently Being Moderated
    I agree and do not really want to use the string concatenation. I am looping through an array in the subProcess. When I use a XSLT transformation in this case how do I have access to the loopCounter? Is there a sample available to show how to do this?

    Thank you
    Rudy
  • 3. Re: Error in parseXML() when data contains "&"
    Daniel Atwood Oracle ACE
    Currently Being Moderated
    Hi Rudy,

    Guessing you probably know this, but you can have an XSLT "for-each" that will iterate through your array.

    If this is all you need to do, here's a video that demonstrates how to do this from the XSLT diagram as well as from the source - http://youtu.be/llULUp3B_CU.

    Hope this helps,
    Dan
  • 4. Re: Error in parseXML() when data contains "&"
    Rudy Meyer Newbie
    Currently Being Moderated
    Hi Daniel,

    Yes, I have used the "for each" before but in this case the loop is in the subProcess and my web service call is within the subProcess so I don't want to iterate the array in the XSLT. The Loop Characteristics of the subProcess are: Loop and the loop condition is a simple expression "loopCounter <= costCodes.costCodes.length()". I would like to attach an image of the subProcess but I don't see how to do that. To describe it; for each costCode in the array I want to do a read to see if it exists, if it does, update it, else create it, end.

    Thank you.

    Edited by: Rudy Meyer on Nov 15, 2012 9:56 AM
  • 5. Re: Error in parseXML() when data contains "&"
    Rudy Meyer Newbie
    Currently Being Moderated
    I found my SubProcess loop characteristics needs to be defined as "MultiInstance" and NOT "Loop". This way I get a handle to each item in the array. After this I was still not able to assign an XSL transformation to my service call. I ended up creating a re-usable process for the service calls and have a Call activity in the loop to pass the item into it. I was then able to use XSL to call the service. This does not seem correct but it is working.

    Thanks

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points