[Xml Records] XML to Recordlist

[Xml Records] XML to Recordlist

  
Is it possible to create a structure that the XML to recordlist action can use for the xml below.

<RespPayload>
   <Status>Success</Status>
   <Results>
      <ResultDetails>
         <Criteria>SSN</Criteria>
         <Value>111222333</Value>
         <Exists>true</Exists>
         <Matched>
            <FirstName>John</FirstName>
            <LastName>Doe</LastName>
            <PhoneNumber>123456789</PhoneNumber>
            <SSN>111222333</SSN>
         </Matched>
      </ResultDetails>
      <ResultDetails>
         <Criteria>PHONE</Criteria>
         <Value>123456789</Value>
         <Exists>true</Exists>
         <Matched>
            <FirstName>Harry</FirstName>
            <LastName>Doe</LastName>
            <PhoneNumber>123456789</PhoneNumber>
            <SSN>111222444</SSN>
         </Matched>
      </ResultDetails>
      <ResultDetails>
         <Criteria>SSN</Criteria>
         <Value>111222333</Value>
         <Exists>true</Exists>
         <Matched>
            <FirstName>Harry</FirstName>
            <LastName>Mills</LastName>
            <PhoneNumber>123456788</PhoneNumber>
            <SSN>111222333</SSN>
         </Matched>
         <Matched>
            <FirstName>John</FirstName>
            <LastName>Mills</LastName>
            <PhoneNumber>123456788</PhoneNumber>
            <SSN>111222555</SSN>
         </Matched>
      </ResultDetails>
   </Results>
   <ErrorDetail>
      <ErrorCode>1E</ErrorCode>
      <ErrorDescription>1ER</ErrorDescription>
      <ErrorSource>ERS</ErrorSource>
      <ErrorDetails>
         <DetailMessage>1D</DetailMessage>
         <DetailMessage>21D</DetailMessage>
         <DetailMessage>34D</DetailMessage>
      </ErrorDetails>
   </ErrorDetail>
</RespPayload>

I can't think of how to make a structure that would accept this xml.
Thoughts??
 
Hi Haruna,

Here is a module that can process the sample XML you have provided.

Later on I'll explain how I built the structures that support this, so you can do this yourself.

Best regards,
Ricardo Silva
How to build the structures to support XML Records:

- if there's an sub-element, you need to add an attribute to the structure
- the top-level structure must have the same name as the root element
- structures must be included as "Record"
- repeated elements must be included as "List of Record"

How does this apply here?

create a RespPayload structure

for sub-element "Status" create an attribute Status of type Text.

Next up we have an element (ResultDetails) which simply has a lot of repeated elements inside. This is a Record List. We'll create the structure of the sub-elements here ( named ResultDetails ).

Create the basic type attributes Criteria, Value and Exists for this structure, to hold the results of the corresponding to the similarly-named elements.

Now we have a Matched attribute which we can tell from the last example can be repeated. So we'll have a List of Record here. Create a new structure named "MatchDetails" to hold the data, and create an attribute named "Matched" of type List of Record with MatchDetails as the only component.

Now add the attributes that make up the MatchDetails data: FirstName, LastName, PhoneNumber and SSN .

Since no more structures are needed, we're done with the "Results" element.

I leave the ErrorDetails element as an exercise to the reader.

Best regards,
Ricardo Silva
Hi Ricardo,

Thanks for this suggestion. I tried to build structure to convert xml to recordlist but not getting how to finish.

Somewhere I have recurring nodes and somewhere I don't have. Can you please suggest me structure for attached XML?

Thanks and Regards,
Suraj Borade