MarkLogic Version : 9.0-6.2
We have an XML document with the element 'CustomerInfo' appearing in multiple places. As per the schema definition, this element is an array (maxOccurs="unbounded") at one place but a regular element in all other places.
I am trying to convert XML to JSON using custom configuration and giving exact path where I want the 'CustomerInfo' element to be converted to an array.
Below is the sample data...
<instance>
<tns:CustomerDownload xmlns:tns="http://new.webservice.namespace"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:CustomerDownloadInfo>
<tns:CustomerInfo>
...
...
Below is the code...
const JsonConfig = json.config('custom');
JsonConfig['array-element-names'] =
['\instance\CustomerDownload\CustomerDownloadInfo\CustomerInfo']
This code is not converting the element to array. If I just give the element name as below, then I see that its converted to array.
JsonConfig['array-element-names'] =['CustomerInfo']
I also tried QName as below but still not converting to array.
JsonConfig['array-element-names'] =
[xs.QName('\instance\CustomerDownload\CustomerDownloadInfo\CustomerInfo')]
How can I specify exact path in JsonConfig['array-element-names'], so that I can explicitly control which elements to be converted to arrays?
Thanks in advance!