[XML Records] XMLtoRecordList namespaces conversion problems

Forge Component
(42)
Published on 25 Nov (13 days ago) by Afonso Carvalho
42 votes
Published on 25 Nov (13 days ago) by Afonso Carvalho

Hello,

The xml I want convert to a record list looks like this: 

<n1:Message xmlns:base="http://namespace.com/test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://namespace.com/test2" xmlns:n1="http://namespace.com/test2" xsi:schemaLocation="http://namespace.com/test.xsd">
  <base:OrderId>04883999</base:OrderId>
  <base:Version>1</base:Version>
  <n1:Assignment>
    <n1:Code>87108758327</n1:Code>
    <n1:Tasks>
      <tns:Number>1</tns:Number>
      <tns:Description>Intake</tns:Description>
    </n1:Tasks>
  </n1:Assignment>
</n1:Message>


I'am having troubles converting the xml to a record list. 

1) Is it possible to convert this xml with multiple namespaces?

2) If so, how does the configuration of the XMLToRecordList look like?

3) Or do you suggest to delete the namespace prefixes (e.g. n1: or tns) before using the XMLToRecordList?


Kind regards,

Rik

Solution

Hi,

It's possible to do this, but it's a bit awkward. I hardcoded an example of an XML with multiple namespaces into the demo espace:


Attached the OML for a code example (ReadXML action in the XmlToRecordList page), let me know if you have any questions.

Solution

Thanks

This works although the xml is actually much bigger so its getting complex and isn't well maintainable.

For later readers of this topic; use Record mode = "C" to get the nesting you want.

Nice. I completely forgot about RecordMode, I don't think I've ever had the need to use it. I'll update the FAQ since this is a common enough use case, and like you've discovered, it's not immediately obvious how you're supposed to implement this.