IMPORT Function (XMLport)

Reads and parses an incoming XML data stream (XML document).

[Ok :=] XMLPORT.IMPORT(Number, InStream)

Parameters

  • Number
    Type: Integer The ID of the XMLport that you want to run. If the XMLport that you specify does not exist, a run-time error occurs.
  • InStream
    Type: ISequentialStream The source from which the import XMLport object will read the XML data stream.

Example

The following example imports data from an XML document to a table. The code uses the OPEN Function (File) to open the XML document named NewCustomer.xml from a folder named Import on the C: drive. The CREATEINSTREAM Function (File) creates a data stream to get the data from the XML document to the table. The IMPORT Function (XMLport) then imports, parses the data and adds it as a record to the table by using an XMLport (50004). The CLOSE Function (File) then closes the data stream. This example assumes that you have created a NewCustomer.xml file in a folder named Import on the C drive and you have created an XMLport and given it ID 50004. This example requires that you create the following variables in the C/AL Globals window.

Variable name DataType

ImportXmlFile

File

XmlINStream

InStream

ImportXmlFile.OPEN('C:\Import\NewCustomer.xml');
ImportXmlFile.CREATEINSTREAM(XmlINStream);
XMLPORT.IMPORT(50004, XmlINStream);
ImportXmlFile.CLOSE;

See Also

Reference

XMLport Data Type

Other Resources

XMLport Walkthroughs