Loop over XML based arrays

Hi,

I am using an XML-document as a source of properties in a service that I am writing in WM 4.6. The XML-document is converted to a record using “getFile”, “stringToDocument” and “documentToRecord”. I am then looping over a recordlist (in-array) in the created record and using another recordlist as out-array.

The problem that I have encountered is that when there is just one element in the array that I am supposed to loop over the array is no longer an array! Instead it is showed just as a record (and not a recordlist) and the looping is therefore not possible.

Any suggested solutions to this problem are highly appreciated!

Br

//Erik

In your documentToRecord service:

  1. Set the arrays value to the name of your input XML RecordList.
  2. Set the makeArrays value to true.
  • Step 1 may be unnecesary if you are specifying the recordName value which conforms to a record definition/structure that you have created.

Erik,

Piara solution will work,and also anytime please use the search functionality in this site,since lot of threads have been discussed on this problem.So this will minimise the duplicate threads.

If possible take some time to register your self and become a member of this site,welcome wmusers!!!

Regards,