I have a xml like <root> <record>Tom,20,male</record>

I have a xml like
<root>
<record>Tom,20,male</record>
<record>Lucy,30,female</record>
...
</root>

How to convert it into a cdt array person(name,age,gender)[] in an expression rule? ...

OriginalPostID-120054

OriginalPostID-120054

  Discussion posts and replies are publicly visible

Parents
  • toRecord() might not help you in this instance because your XML is not well defined to map directly into the Person CDT.
    What you need to do is create a RULE that takes each element (that is <record>) from this XML and tokenizes the string to get the three of the values as an array.
    Then you need to use the type!person() function to build each element of your CDT
    So you would do something like
    type!person(name:ri!myparsedArray[0], age:ri!myparsedArray[1] ...)
    Then you call this rule within an apply function and you iterate through each of the <record> element
    Let me know if this is clear.
Reply
  • toRecord() might not help you in this instance because your XML is not well defined to map directly into the Person CDT.
    What you need to do is create a RULE that takes each element (that is <record>) from this XML and tokenizes the string to get the three of the values as an array.
    Then you need to use the type!person() function to build each element of your CDT
    So you would do something like
    type!person(name:ri!myparsedArray[0], age:ri!myparsedArray[1] ...)
    Then you call this rule within an apply function and you iterate through each of the <record> element
    Let me know if this is clear.
Children
No Data