I have created a XMLport (&codeunit) for importing purchase order header and po lines from an XML. All fields are defined as text and they are now evaluated into correct format & field - some are also being modified a bit more, eg. dates.
I followed the advices here and also many other feeds here and other forums.
https://docs.microsoft.com/en-us/dynamics-nav/walkthrough--inserting-data-from-xml-documents-to-multiple-tables
Currently I am experiencing an error when running the codeunit to import the data. The error is: "Unexptected end of file has occured. The following elements are not closed. Line 22, position 7."
The XML file I am trying to read has the last character ">" on line 22, position 6.
The codeunit has these lines:
varXmlFile.OPEN('filelocation.xml');
varXmlFile.CREATEINSTREAM(varInputStream);
XMLPORT.IMPORT(XMLPORT::"Custom Purch Order Import", varInputStream);
varXmlFile.CLOSE;
Should the codeunit somehow be modified that the end of the XML file is somehow checked and input ends there. Etc, etc?
And I must answer myself right away. The final row of the XML was missing, so error information given by NAV was very correct once again!.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156