Absent Member.. John4 Absent Member..
Absent Member..
85 views

Count the number of tags in xml reponse.

 

I want to know how to count the number of tags in an xml reponse. For example in the below xml response, I want to be able to count the number of <v20141114:interactionID> tags.

 

 

 

MMyCases.c(8):     <SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"></SOAP-ENV:Hea
MyCases.c(8):     der><SOAP-ENV:Body>\n
MyCases.c(8):     <v20141114:GetInteractionCaseDetailsRs xmlns:v20051112="http://tss.jpmorganchase.com/2005/
MyCases.c(8):     11/12" xmlns:v20070623="http://tss.jpmorganchase.com/2007/06/23" xmlns:v20141114="http://t
MyCases.c(8):     ss.jpmorganchase.com/2014/11/14">\n
MyCases.c(8):       <v20070623:ResponseMessage>\n
MyCases.c(8):         <v20070623:responseCD>0</v20070623:responseCD>\n
MyCases.c(8):         <v20070623:contextID>3dfc36b0-391b-14a3-b9e0-a9a552182ad0</v20070623:contextID>\n
MyCases.c(8):       </v20070623:ResponseMessage>\n
MyCases.c(8):       <v20141114:PrimaryInteractionDetails>\n
MyCases.c(8):         <v20141114:interactionID>201406200002115</v20141114:interactionID>\n
MyCases.c(8):         <v20141114:businessUnitCD>TS000</v20141114:businessUnitCD>\n
MyCases.c(8):         <v20141114:createdDT>2014-06-20 04:14:56 PM</v20141114:createdDT>\n
MyCases.c(8):         <v20141114:sourceCD>AUTO</v20141114:sourceCD>\n
MyCases.c(8):         <v20141114:createdByNM>Inboundemail Handler</v20141114:createdByNM>\n
MyCases.c(8):         <v20141114:escalationIN>N</v20141114:escalationIN>\n
MyCases.c(8):         <v20141114:priorityCD>MED</v20141114:priorityCD>\n
MyCases.c(8):         <v20141114:slaStatusCD>3</v20141114:slaStatusCD>\n
MyCases.c(8):         <v20141114:statusCD>OPEN</v20141114:statusCD>\n
MyCases.c(8):         <v20141114:transactionTypeCD>OTHER</v20141114:transactionTypeCD>\n
MyCases.c(8):         <v20141114:pgReadIN>N</v20141114:pgReadIN>\n
MyCases.c(8):         <v20141114:slaTS></v20141114:slaTS>\n
MyCases.c(8):         <v20141114:ecID>TEMP-COM-01</v20141114:ecID>\n
MyCases.c(8):         <v20141114:clientNM>Generic COM Client - CAS ID TBD</v20141114:clientNM>\n
MyCases.c(8):         <v20141114:odsContactID></v20141114:odsContactID>\n
MyCases.c(8):         <v20141114:contactFirstNM>RAJAPANDIAN</v20141114:contactFirstNM>\n
MyCases.c(8):         <v20141114:contactLastNM>UTHAYAKUMAR</v20141114:contactLastNM>\n
MyCases.c(8):         <v20141114:contactEmailID>karthick.rajagopal@jpmchase.com</v20141114:contactEmailID>\n
MyCases.c(8):         <v20141114:contactPhoneNB>9999999999</v20141114:contactPhoneNB>\n
MyCases.c(8):         <v20141114:assigneeNM>D418718 D418718</v20141114:assigneeNM>\n
MyCases.c(8):         <v20141114:assigneePgNM>SC-WHEM-Test-Provider-Group-1</v20141114:assigneePgNM>\n
MyCases.c(8):         <v20141114:ownerNM>Inboundemail Handler</v20141114:ownerNM>\n
MyCases.c(8):         <v20141114:ownerPgNM>SC-WHEM-Test-Provider-Group-1</v20141114:ownerPgNM>\n
MyCases.c(8):         <v20141114:lastUpdatedTS>2014-06-20 04:14:56 PM</v20141114:lastUpdatedTS>\n
MyCases.c(8):         <v20141114:lastUpdatedByNM>Inboundemail Handler</v20141114:lastUpdatedByNM>\n
MyCases.c(8):         <v20141114:lastUpdatedByID>D418718</v20141114:lastUpdatedByID>\n
MyCases.c(8):         <v20141114:subProductCD>COMMERCIAL LOANS</v20141114:subProductCD>\n
MyCases.c(8):         <v20141114:reasonTX>Maintenance</v20141114:reasonTX>\n
MyCases.c(8):         <v20141114:rootSourceTX>JPM</v20141114:rootSourceTX>\n
MyCases.c(8):         <v20141114:rootCauseTX>Maintenance-Mkt</v20141114:rootCauseTX>\n
MyCases.c(8):         <v20141114:caseTypeTX>Change</v20141114:caseTypeTX>\n
MyCases.c(8):         <v20141114:is
MyCases.c(8): t=686ms: 3376-byte response body for "http://isb-perf.jpmchase.net:55150/soap/msg" (RelFrameId=1, Internal ID=1)
MyCases.c(8):     UsdIN>N</v20141114:isUsdIN>\n
MyCases.c(8):         <v20141114:isCraIN>N</v20141114:isCraIN>\n
MyCases.c(8):         <v20141114:investigationCaseIN>N</v20141114:investigationCaseIN>\n
MyCases.c(8):         <v20141114:editAccessIN>Y</v20141114:editAccessIN>\n
MyCases.c(8):         <v20141114:receivedDT>2014-06-20 04:14:56 PM</v20141114:receivedDT>\n
MyCases.c(8):         <v20141114:summaryTX>Update Grid Pricing on obligations(s)</v20141114:summaryTX>\n
MyCases.c(8):         <v20141114:itemCountNB>1</v20141114:itemCountNB>\n
MyCases.c(8):         <v20141114:timeToRedTX>270D 1H</v20141114:timeToRedTX>\n
MyCases.c(8):         <v20141114:sortByTtrTX>106481</v20141114:sortByTtrTX>\n
MyCases.c(8):         <v20141114:wlInstanceID>52231204</v20141114:wlInstanceID>\n
MyCases.c(8):       </v20141114:PrimaryInteractionDetails>\n
MyCases.c(8):       <v20141114:PrimaryInteractionDetails>\n
MyCases.c(8):         <v20141114:interactionID>201406200002114</v20141114:interactionID>\n
MyCases.c(8):         <v20141114:businessUnitCD>TS000</v20141114:businessUnitCD>\n
MyCases.c(8):         <v20141114:createdDT>2014-06-20 04:14:54 PM</v20141114:createdDT>\n
MyCases.c(8):         <v20141114:sourceCD>AUTO</v20141114:sourceCD>\n
MyCases.c(8):         <v20141114:createdByNM>Inboundemail Handler</v20141114:createdByNM>\n
MyCases.c(8):         <v20141114:escalationIN>N</v20141114:escalationIN>\n
MyCases.c(8):         <v20141114:priorityCD>MED</v20141114:priorityCD>\n
MyCases.c(8):         <v20141114:slaStatusCD>3</v20141114:slaStatusCD>\n
MyCases.c(8):         <v20141114:statusCD>OPEN</v20141114:statusCD>\n
MyCases.c(8):         <v20141114:transactionTypeCD>OTHER</v20141114:transactionTypeCD>\n
MyCases.c(8):         <v20141114:pgReadIN>N</v20141114:pgReadIN>\n
MyCases.c(8):         <v20141114:slaTS></v20141114:slaTS>\n
MyCases.c(8):         <v20141114:ecID>TEMP-COM-01</v20141114:ecID>\n
MyCases.c(8):         <v20141114:clientNM>Generic COM Client - CAS ID TBD</v20141114:clientNM>\n
MyCases.c(8):         <v20141114:odsContactID></v20141114:odsContactID>\n
MyCases.c(8):         <v20141114:contactFirstNM>RAJAPANDIAN</v20141114:contactFirstNM>\n
MyCases.c(8):         <v20141114:contactLastNM>UTHAYAKUMAR</v20141114:contactLastNM>\n
MyCases.c(8):         <v20141114:contactEmailID>karthick.rajagopal@jpmchase.com</v20141114:contactEmailID>\n
MyCases.c(8):         <v20141114:contactPhoneNB>9999999999</v20141114:contactPhoneNB>\n
MyCases.c(8):         <v20141114:assigneeNM>D418718 D418718</v20141114:assigneeNM>\n
MyCases.c(8):         <v20141114:assigneePgNM>SC-WHEM-Test-Provider-Group-1</v20141114:assigneePgNM>\n
MyCases.c(8):         <v20141114:ownerNM>Inboundemail Handler</v20141114:ownerNM>\n
MyCases.c(8):         <v20141114:ownerPgNM>SC-WHEM-Test-Provider-Group-1</v20141114:ownerPgNM>\n
MyCases.c(8):         <v20141114:lastUpdatedTS>2014-06-20 04:14:54 PM</v20141114:lastUpdatedTS>\n
MyCases.c(8):         <v20141114:lastUpdatedByNM>Inboundemail Handler</v20141114:lastUpdatedByNM>\n
MyCases.c(8):         <v20141114:lastUpdatedByID>D418718</v20141114:lastUpdatedByID>\n
MyCases.c(8):         <v20141114:subProductCD>COMMERCIAL LOANS</v20141114:subProductCD>\n
MyCases.c(8):         <v20141114:reasonTX>Maintenance</v20141114:reasonTX>\n
MyCases.c(8):         <v20141114:rootSourceTX>JPM</v20141114:rootSourceTX>\n
MyCases.c(8):         <v20141114:rootCauseTX>Maintenance-Mkt</v20141114:rootCauseTX>\n
MyCases.c(8):         <v20141114:caseTypeTX>Change</v20141114:caseTypeTX>\n
MyCases.c(8):         <v20141114:isUsdIN>N</v20141114:isUsdIN>\n
MyCases.c(8):         <v20141114:isCraIN>N</v20141114:isCraIN>\n
MyCases.c(8):         <v20141114:investigationCaseIN>N</v20141114:investigationCaseIN>\n
MyCases.c(8):         <v20141114:editAccessIN>Y</v20141114:editAccessIN>\n
MyCases.c(8):         <v20141114:receivedDT>2014-06-20 04:14:54 PM</v20141114:receivedDT>\n
MyCases.c(8):         <v20141114:summaryTX>Update Grid Pricing on obligations(s)</v20141114:summaryTX>\n
MyCases.c(8):         <v20141114:itemCountNB>1</v20141114:itemCountNB>\n
MyCases.c(8):         <v20141114:timeToRedTX>270D 1H</v20141114:timeToRedTX>\n
MyCases.c(8):         <v20141114:sortByTtrTX>106481</v20141114:sortByTtrTX>\n
MyCases.c(8):         <v20141114:wlInstanceID>52231201</v20141114:wlInstanceID>\n
MyCases.c(8):       </v20141114:PrimaryInteractionDetails>\n
MyCases.c(8):     </v20141114:GetInteractionCaseDetailsRs></SOAP-ENV:Body>\n
MyCases.c(8):     </SOAP-ENV:Envelope>\n

0 Likes
6 Replies
rmora Absent Member.
Absent Member.

Re: Count the number of tags in xml reponse.

You can use the web_reg_save_param_ex function and set the parameter Ordinal=ALL. This will create an additional parameter with how many parameters it created, same as counting the tags, with the name parametername_count

 

Also, I'm sure there is a way to do it manually with the xml_* functions, a for loop and some custom code, but you would need to develop it in ANSI C code.

0 Likes
Absent Member.. John4 Absent Member..
Absent Member..

Re: Count the number of tags in xml reponse.

 

I have already tried that. It seems to not be working. Here is the request I am sending:

 

When I try to use the web_reg_save_param_ex function, the script is aborting. Else it passes

 

soap_request("StepName=SOAP Request",
              "URL=####",
              "SOAPEnvelope="
             "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> <SOAP-ENV:Header xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" />"
   "<soap:Body>"
     "<ns3:GetInteractionCaseDetailsRq xmlns:ns3=\"####" xmlns=\"#####" xmlns:ns2=\"http://tss.jpmorganchase.com/2005/11/12\">"
         "<RequestHeader>"
            "<User>"
               "<userID>D418718</userID>"
               "<firstNM>D418718</firstNM>"
               "<lastNM>D418718</lastNM>"
               "<lineOfBusinessTX>COM00</lineOfBusinessTX>"
            "</User>"
            "<submitTime>2015-03-03 15:06:41</submitTime>"
            "<requestingAppNM>ISD</requestingAppNM>"
            "<requestingAppVer>1.0</requestingAppVer>"
         "</RequestHeader>"
         "<ns3:InteractionRequest>"
            "<ns3:showSelectionCD>MYCASE</ns3:showSelectionCD>"
         "</ns3:InteractionRequest>"
         "<ns3:typeCD>WORKLIST</ns3:typeCD>"
      "</ns3:GetInteractionCaseDetailsRq>"
   "</soap:Body>"
"</soap:Envelope>",
"SOAPAction=",
"ResponseParam=response",
"Snapshot=t1393501135.inf",                                        
LAST);

0 Likes
rmora Absent Member.
Absent Member.

Re: Count the number of tags in xml reponse.

What is the web_reg_save_param_ex function that you are using?

0 Likes
Absent Member.. John4 Absent Member..
Absent Member..

Re: Count the number of tags in xml reponse.

 

 

    web_reg_save_param_ex("ParamName=interactionList","LB=interactionID>","RB=</v20141114","Ordinal=All",LAST);

0 Likes
Absent Member.. John4 Absent Member..
Absent Member..

Re: Count the number of tags in xml reponse.

 

Any update? I have posted my function above

0 Likes
Dennis Honored Contributor.
Honored Contributor.

Re: Count the number of tags in xml reponse.

Hi John4,

 

If you wan´t to count all the instances of <v20141114:interactionID> you could use:

 

 

web_reg_find("Text=<v20141114:interactionID>",

        "SaveCount=NumberOfIteractionID",
        LAST);

 

Put this before you´re custom_request.

 

The number of interactionID is now stored in the parameter NumberOfIteractionID

 

NB: If this solves your problem / helps you on the way, consider acknowledging with Kudos. To kudo a post, select the thumbs up icon in the gray square by the post in the thread.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.