[XML Records] Record Lists VS Records

[XML Records] Record Lists VS Records

  
Forge Component
(24)
Published on 15 Jun by Ricardo Silva
24 votes
Published on 15 Jun by Ricardo Silva
Hi,

I created a structure for Contacts and I am trying to convert an XML text into a record list of the said structure.

The first test that I did was using the text below:

"<Contact>
<contactUid>9493094</contactUid>
<utcFirstCreated>2014-07-31T03:12:40</utcFirstCreated>
<utcLastModified>2014-07-31T03:12:40</utcLastModified>
<lastUpdatedUid>AAAAAE39cYU=</lastUpdatedUid>
<salutation>Mr.</salutation>
<givenName>Peter</givenName>
</Contact>"

It was successfully display in my TableRecords. But really, I am expecting a list of contacts to be converted to a record list. So I did below:

"<Contact>
<contactUid>9493094</contactUid>
...
<salutation>Mr.</salutation>
<givenName>Peter</givenName>
</Contact>
<Contact>
<contactUid>9493094</contactUid>
...
<lastUpdatedUid>AAAAAE39cYU=</lastUpdatedUid>
<salutation>Mr.</salutation>
<givenName>Peter</givenName>
</Contact>"

Obviously, it returned an error. Then I tried to wrap the XML with a <Contacts> tag, like below:

<Contacts>
   <Contact>
     ....
  </Contact>
  <Contact>
     ....
  </Contact>
</Contacts>

But it returned the error:

The parameter that I put for the XmlToRecordList action for the RecordList parameter is: ToObject(Contacts), Contacts is a record list of Contact structure.

Any help? Thanks!
I made it work by creating another structure, Contacts having one field Contact of type record list (of the original Contact structure). Is this the supposed solution? I basically copied how the user list works in the example OML.
If you were importing the Record List from an existing OS structure (Record List variable, Query output...), it wouldn't be necessary.
When converting xml, yes, that's the way.