I would like to convert the following XML to a CDT. I have no problem capturing the values in Key, LastModified, and Size using torecord(). However, I do not know how to create a field in my CDT to capture DisplayName using torecord() since it is nested in Owner. Please let me the best way to get the data in this XML.
<Result><Key>Mock_Doc.pdf</Key><LastModified>2023-10-06T02:19:06.000Z</LastModified><Size>38864</Size><Owner> <DisplayName>Tracy</DisplayName></Owner></Result>
Discussion posts and replies are publicly visible
Did you consider to fetch the values from the XML using xPath? This way you are super flexible and do not have to create a CDT that exactly matches the XML.
Thanks for the reply. Yes, xpathsnippet() and extract() both give me the data I want. However, I am trying to avoid those extra steps. I was wondering if there was a way to set up the CDT so I can just use torecord() to get all the data points at once, including the data in the nested tags.
I ended up using xml-parser and fromjson. It returned all the values nicely.
To satisfy your curiosity, yes, simple and easy. Just create a nested CDT.
Thanks