I have below XML data. I want to extract values of 'wd:Document_ID' from below XML
<?xml version='1.0' encoding='UTF-8'?>
<wd:Report_Data xmlns:wd="urn:com.workday/bsvc">
<wd:Report_Entry>
<wd:CF_INT610_Get_Event_Date wd:Descriptor="aaa_active_ee_int_20210811.csv.pgp">
<wd:ID wd:type="WID">b69474eb8a4501fe782254c15701d81b</wd:ID>
<wd:ID wd:type="Document_ID">cloud/631f5e75-670d-4675-173b-1142154c3128</wd:ID>
</wd:CF_INT610_Get_Event_Date>
<wd:CF_INT557_Parent_Runtime_Files>2021-08-11T05:31:00.000-07:00</wd:CF_INT557_Parent_Runtime_Files>
<wd:Integration_System wd:Descriptor="INT580 MDT Main">
<wd:ID wd:type="WID">751bfef1817b01917d8b76af8928764c</wd:ID>
<wd:ID wd:type="Integration_System_ID">INT_Studio_Multi_Document_Transform/multiDocumentTransform/In</wd:ID>
</wd:Integration_System>
<wd:Request_Name wd:Descriptor="INT580 MDT Main @ INT568 ACTIVE EE Data Extract">
<wd:ID wd:type="WID">9a1aef989c88013caa2eb90757011730</wd:ID>
<wd:ID wd:type="Background_Process_Instance_ID">INTEGRATION_EVENT-6-608980</wd:ID>
</wd:Request_Name>
<wd:Integration_Event wd:Descriptor="INT580 MDT Main - 11 Aug, 2021 5:17:46.793 AM (Completed)">
<wd:ID wd:type="WID">9a1aef989c88013caa2eb90757011730</wd:ID>
<wd:ID wd:type="Background_Process_Instance_ID">INTEGRATION_EVENT-6-608980</wd:ID>
</wd:Integration_Event>
<wd:Actual_Completed_Date_and_Time>2021-08-11T05:32:09.225-07:00</wd:Actual_Completed_Date_and_Time>
<wd:Integration_Event_Status wd:Descriptor="Completed">
<wd:ID wd:type="WID">d8b0bcd8446c11de98360015c5e6daf6</wd:ID>
<wd:ID wd:type="Background_Process_Instance_Status_ID">Completed</wd:ID>
</wd:Integration_Event_Status>
<wd:Output_Documents_group>
<wd:File>mgti_aaa_active_ee_int_20210811.csv.pgp</wd:File>
<wd:Document_ID>cloud/121b6d-5c1c-456e-3124c-0a2121696d16</wd:Document_ID>
</wd:Output_Documents_group>
<wd:Output_Documents_group>
<wd:File>aaa_active_ee_int_20210811.csv.pgp</wd:File>
<wd:Document_ID>cloud/1211f5e75-670d-4675-173b-11214c3128</wd:Document_ID>
</wd:Output_Documents_group>
</wd:Report_Entry>
</wd:Report_Data>
I am using below Extract Variable Policy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables continueOnError="false" enabled="true" name="EV-DocumentID">
<DisplayName>EV-DocumentID</DisplayName>
<Properties/>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<Source clearPayload="false">request</Source>
<VariablePrefix>wd:Report_Data</VariablePrefix>
<XMLPayload stopPayloadProcessing="false">
<Namespaces/>
<Variable name="docid" type="string">
<XPath>//wd:Report_Data/wd:Report_Entry[1]/wd:Output_Documents_group/wd:Document_ID/text()</XPath>
</Variable>
</XMLPayload>
</ExtractVariables>
I am getting below error
instance "int-non-prod-1" reported error steps.extractvariables.XPathCompilationFailed: "ExtractVariables //wd:Report_Data/wd:Report_Entry[1]/wd:Output_Documents_group/wd:Document_ID/text(): Failed to compile xpath {1}. Context {2}"
Solved! Go to Solution.
hey @praviningawale
so in order to solve your problem, you should have read about more on extract_variable_policy you are using variable prefix and there is no sense in using this if you have namespaces in your XML payload then you must use namespaces_prefix
and there you go.
and removing wd from XML payload is good but if you have a huge payload then it is a tricky task
let me know if you are still not able to do so
cheers ~
As I can see the payload you're using is having the prefix of wd: which is why this error is occurring as in Extract Variable policy it seems to be an Invalid XML Structure that responds to you like the compilation error so as the solution just you have to remove this wd: part from XML Payload and also in EXTRACT VARIABLE Policy structure as follows:
<XPath>/Report_Data/Report_Entry/Output_Documents_group[1]/Document_ID</XPath>
which will solve your problem of extracting the data from XML Payload.
hey @praviningawale
so in order to solve your problem, you should have read about more on extract_variable_policy you are using variable prefix and there is no sense in using this if you have namespaces in your XML payload then you must use namespaces_prefix
and there you go.
and removing wd from XML payload is good but if you have a huge payload then it is a tricky task
let me know if you are still not able to do so
cheers ~
Hi Rohan
I had missed adding namespace in the EV policy. When I added the error was resolved.
Glad you got it to work