'Import XML files in a view in Marklogic

I need some suggestions on the topic- import xml files in a view under a schema and the files will be imported in collection into Marklogic. For csv files/ excel files we can use the template driven extraction method.

As XML files have a hierarchy of elements, so is that possible to create a structure of that xml file in a template and load the actual file with mlcp import?

Example of the XML file :

<ns9:DocumentHeader>
        <ns9:DocRef>1234</ns9:DocRef>
        <ns9:DocCreateDt>2021-02-21T18:51:43.2644278Z</ns9:DocCreateDt>
        <ns9:DocType>Shipment</ns9:DocType>
        <ns9:DocModified>Test</ns9:DocModified>
        <ns9:DocModifiedDt>2021-02-21T18:51:58.3422988Z</ns9:DocModifiedDt>
        <ns9:Version>
            <ns9:CurrentVersion>
                <ns9:User>System</ns9:User>
                <ns9:Timestamp>2021-07-20T16:12:00.3079321+01:00</ns9:Timestamp>
                <ns9:Comments />
                <ns9:VersionMajor>0</ns9:VersionMajor>
                <ns9:VersionMinor>0</ns9:VersionMinor>
                <ns9:DocStatus>
                    <ns9:StatusID>9900100</ns9:StatusID>
                    <ns9:StatusName>Updated</ns9:StatusName>
                </ns9:DocStatus>
                <ns9:Reason />
            </ns9:CurrentVersion>
</ns9:Version>
</ns9:DocumentHeader>

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source