The AL language extension has native support for handling XML and JSON documents.
An XML document is represented by using the XmlDocument data type, as explained at https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/xmldocument/xmldocument-data-type.
The following code shows how you can import an XML file and load it into an XmlDocument object:
local procedure ImportXML()
var
TempBlob : Codeunit "Temp Blob";
TargetXmlDoc : XmlDocument;
XmlDec : XmlDeclaration;
Instr: InStream;
filename: Text;
begin
// Create the Xml Document
TargetXmlDoc := XmlDocument.Create;
xmlDec := xmlDeclaration.Create('1.0','UTF-8','');
TargetXmlDoc.SetDeclaration(xmlDec);
// Create an Instream...