Import of complex XML file

Hi all,

I have a quite complex XML file that I need to import into NAV. I have previously used the data exchange framework to import CSV file which basically contained the same information, so naturally I hoped that I would be able to reuse this functionality.

<xml>
    <transactions>
        <transaction date="1525859543">
            <document pdmweid="1920">
                <configuration name="ITEM SUBJECT" quantity="1">
                    <attribute name="Revision" value="D"/>
                    <attribute name="Description" value="Item Description"/>
                    <attribute name="Unit" value="PCS"/>
                    <attribute name="Number" value="ITEM1"/>
                    <attribute name="Type" value="Item"/>
                    <references>
                        <document pdmweid="1197">
                            <configuration name="Default" quantity="1">
                                <attribute name="Revision" value="B"/>
                                <attribute name="Description" value="Item Description"/>
                                <attribute name="Unit" value="PCS"/>
                                <attribute name="Number" value="ITEM2"/>
                                <attribute name="Type" value="Item"/>
                            </configuration>
                        </document>
                        <document pdmweid="1424">
                            <configuration name="Default" quantity="2">
                                <attribute name="Revision" value="B"/>
                                <attribute name="Description" value="Item Description"/>
                                <attribute name="Unit" value="PCS"/>
                                <attribute name="Number" value="ITEM3"/>
                                <attribute name="Type" value="Item"/>
                                <references>
                                    <document pdmweid="1368">
                                        <configuration name="Default" quantity="1">
                                            <attribute name="Revision" value="B"/>
                                            <attribute name="Description" value="Item Description"/>
                                            <attribute name="Unit" value="PCS"/>
                                            <attribute name="Number" value="ITEM30"/>
                                            <attribute name="Type" value="Item"/>
                                            <references>
                                                <document aliasset="" pdmweid="1366">
                                                    <configuration name="Default" quantity="1">
                                                        <attribute name="Revision" value="B"/>
                                                        <attribute name="Description" value="Item Description"/>
                                                        <attribute name="Unit" value="PCS"/>
                                                        <attribute name="Number" value="ITEM31"/>
                                                        <attribute name="Type" value="Item"/>
                                                    </configuration>
                                                </document>
                                                <document aliasset="" pdmweid="1367">
                                                    <configuration name="Default" quantity="2">
                                                        <attribute name="Revision" value="B"/>
                                                        <attribute name="Description" value="Item Description"/>
                                                        <attribute name="Unit" value="PCS"/>
                                                        <attribute name="Number" value="ITEM32"/>
                                                        <attribute name="Type" value="Item"/>
                                                    </configuration>
                                                </document>
                                            </references>
                                        </configuration>
                                    </document>
                                </references>
                            </configuration>
                        </document>
                    </references>
                </configuration>
            </document>
        </transaction>
    </transactions>
</xml>

This is a simplified version of the file. The file could potentially go into levels of <Document><Configuration><References><Document> elements and sub elements. As the knowledgeable eye can see, then we talk about a multi-level BOM. They need to be imported into job planning lines and whenever an item does not exists in NAV, then it must also create the item and create or modify the assembly BOM.

The file contains two challenges which to my knowledge prevents me from using either XMLPorts or the data exchange framework.

  1. Instead of using unique element names like <attributevalue>attributevalue</attributename>, then it uses <attribute name="attributname" value="attributevalue">. It makes it difficult, if not impossible, to do in XMLPorts and impossible with the standard data exchange framework.
  2. Theoretically the BOM could have unlimited levels, practically we may be able to limit this to 10 or more. I can't really imagine how to define this in the data exchange framework. If issue 1 is solved, then XMLports could be the answer?

Have any of you worked with such an XML file before? Or just one with attribute name/values instead of elements.

Did you use XMLPorts or data exchange framework?

Of course I could hand code the importing using XMLDOM (dotnet), but would love to avoid that. 

We are on NAV 2018.

Related
Recommended