I have a XML response which I have received as output of a System link(Infor XA related)process. The response would look like below:
**<?xml version="1.0" encoding="UTF-8"?>
-<System-Link hostVersion="1.0" version="1.0">
-<Response hasWarnings="false" hasErrors="true" systemTimeZoneOffset="-5:00"
systemTimestamp="2017-08-22 03:37:01.115"
workHandle="-1e4c99eb:15dff5e8e61:-796d"
sessionHandle="-1e4c99eb:15dff5e8e61:-7970">
-<UpdateResponse actionSucceeded="false"
requestedDomainClass="com.mapics.epdm.BillOfMaterialComponent"
name="updateObject_BillofMaterial Component_1">
-<Exception name="com.pjx.eScript.ObjectNotFoundException">
-<Text>
<![CDATA[Object does not exist]]>
</Text>
-<Message type="error">
-<Text>
<![CDATA[The named object was not found.]]>
</Text>
</Message>
</Exception>
</UpdateResponse>
<UpdateResponse actionSucceeded="true"
requestedDomainClass="com.mapics.epdm.BillOfMaterialComponent"
name="updateObject_BillofMaterial Component_2"/>
<UpdateResponse actionSucceeded="true"
requestedDomainClass="com.mapics.epdm.BillOfMaterialComponent"
name="updateObject_BillofMaterial Component_3"/>
<UpdateResponse actionSucceeded="true"
requestedDomainClass="com.mapics.epdm.BillOfMaterialComponent"
name="updateObject_BillofMaterial Component_4"/>
<UpdateResponse actionSucceeded="true"
requestedDomainClass="com.mapics.epdm.BillOfMaterialComponent"
name="updateObject_BillofMaterial Component_5"/>
</Response>
</System-Link>**
So I need to get the 'actionSucceeded' value of all the responses(Which would be on one transaction). If it is false, then I would like to get the . Is there a RPG XML function to get this? Basically I need to know if my request was success or not by checking the response(as shown above) and not doing a Scan through the entire request
Use the opcode XML-SAX to parse the xml document. See the IBM Knowledge Center for more info on the opcode, https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzasd/zzxmlsa.htm .
I use XML-SAX to parse an xml document (configuration file) in one of my projects, see BlueDroplet XML Configuration Provider .
And my opinion: Don't use Java for anything you can easily also do in RPG when your main code base is already RPG.