In the following example, we are going to: open a file, create an InStream object, create an XmlDocument using the DotNet component and load the XML from the InStream.
This example requires that you create the following variables:
Name | DataType | Subtype |
TestFile | File | |
Istream | InStream | |
XmlDoc | DotNet | System.Xml.XmlDocument.’System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ |
HOW TO load xml from a file in C/AL?
TestFile.OPEN('C:\TestFolder\TestFile.xml');
TestFile.CREATEINSTREAM(Istream);
XmlDoc := XmlDoc.XmlDocument();
XmlDoc.Load(Istream);
Did my HOW TO help you? Leave a reply.
2 replies on “HOW TO load xml from a file in C/AL”
Hi,
Thanks for the post and it help me
But my question is how can we load In stream file in BC SAAS ?
Because .net and File related variable functions are not allowed.
Hi,
in BC you have new data types including XmlDocument you can find the documentation in the following link:
https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/xmldocument/xmldocument-data-type