Reputation: 449
I am loading some xml files in Marklogic database using Templates and mlcp import. One namespace in those files is not allowing the data import in the marklogic though there is no error thrown after executing the mlcp import command.
When I omit that particular namespace from the files, the data gets imported successfully.
Can we use any command to omit the namespace prior hand before loading the data in marklogic ? The namespace which creating issue is - xmlns="http://www.globaltrademanagement_export.com/Shipment
Sample XML-
<?xml version="1.0" encoding="utf-8"?>
<Shipment xmlns:ns10="http://www.globaltrademanagement_export.com/ASN"
xmlns:ns9="http://www.globaltrademanagement_export.com/BaseType"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.globaltrademanagement_export.com/Shipment file:///Y:/MapForce/Projects/GTM2/schema/Shipment.xsd"
xmlns="http://www.globaltrademanagement_export.com/Shipment">
<ns9:DocumentHeader>
<ns9:DocRef>123</ns9:DocRef>
<ns9:DocCreateDt>2021-10-21T13:01:39.2521396+01:00</ns9:DocCreateDt>
<ns9:DocType>Shipment</ns9:DocType>
</ns9:DocumentHeader>
<ns10:ASN>
<ns9:DocumentHeader>
<ns9:DocRef>123</ns9:DocRef>
<ns9:DocType>ASN</ns9:DocType>
<ns9:DocModified>0000000</ns9:DocModified>
<ns9:DocModifiedDt xsi:nil="true" />
</ns9:DocumentHeader>
<ns10:OSP xmlns:ns10="http://www.globaltrademanagement_export.com/ASN">
<ns9:PartyName />
</ns10:OSP>
<ns10:MultiFreightJobHeader>
<MultiFreightRef xmlns="http://www.globaltrademanagement_export.com/ASN">SEIIUSJ00010129</MultiFreightRef>
<Dept xmlns="http://www.globaltrademanagement_export.com/ASN">SEI</Dept>
<Route xmlns="http://www.globaltrademanagement_export.com/ASN">IUS</Route>
</ns10:MultiFreightJobHeader>
</ns10:ASN>
</Shipment>
Upvotes: 1
Views: 83
Reputation: 449
Solution as suggested by @Madshansen - I have added the namespaces in the template itself. Like this -
<path-namespace>
<prefix>xmlns:ns99</prefix>
<namespace-uri>globaltrademanagement_export.com/Shipment</namespace-uri>
</path-namespace>
I have then added the prefix(ns99) with this namespace and appended that namespace-prefix for all the elements which does not have any namespace-prefix, and I did this in my template definition. And it worked successfully !! Thanks @Madshansen
Upvotes: 1