IPWorks EDI 2020 macOS Edition

Questions / Feedback?

Translate Method

Translates the specified data.

Syntax

public func translate() throws -> Void

Remarks

This method translates the specified data.

The class will convert a document from the format specified by InputFormat to the format specified by OutputFormat. In practice this allows for converting to XML or JSON from EDI and vice versa.

Before translating from EDI to XML or JSON it is recommended to load a schema using the LoadSchema method. This ensures additional information can be included in the XML or JSON document. If a schema is specified the XML or JSON will include types and descriptions as element attributes which are useful for interpreting the data.

EDI elements may optionally be renamed when creating XML. To define how an element is renamed add a renaming rule by calling AddRenamingRule.

After calling Translate the resulting output will contain the EDI, XML or JSON data as defined by OutputFormat. If the output data is XML the ExportXMLSchema method may be called to export a schema (.xsd) defining the structure of a valid XML document. XML documents which adhere to this document may be translated from XML to EDI.

Input and Output Properties

The class will determine the source and destination of the input and output based on which properties are set.

The order in which the input properties are checked is as follows:

When a valid source is found the search stops. The order in which the output properties are checked is as follows:
  • OutputFile
  • OutputData: The output data is written to this property if no other destination is specified.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks EDI 2020 macOS Edition - Version 20.0 [Build 8203]