Framework EDI Reference. Methods and Properties
xmlDocument. LoadEdi

Loads an EDI document in XML format.

Syntax:

Parameters:

Returns:

Returns 1 if the operation is successful; otherwise the operation returns zero.  For detailed information of the error, interrogate the FREDI.ediWarnings interface to list all the warnings and errors generated.

Remarks:

LoadEdi method loads an EDI document that is presented in XML format.  The data is processed in the context of the ediDocument interface from which this xmlDocument interface was retrieved.  All properties, options, etc. that control how the document is to be processed are set in the ediDocument, as well as all the schemas necessary in translating the document.

The XML file format currently must follow these general guidelines to be translated as an EDI document:

  1. XML files following version 1.0 specification are currently the only version that can be translated.  If the version declaration is not specified, it is assumed that the XML file follows version 1.0 specification.
  2. Only XML files encoded in ISO-8859-1 is currently supported.
  3. The root element must have a beginning substring of “EDI-X12” to be translated as an ASC/X12 document; otherwise it will be translated as a UN/EDIFACT document.  Example EDIFACT root element.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<EDI-D97B>
    <Interchange-Control>
          
:
    </Interchange-Control>
</EDI-D97B>

 

  1. Data segments are represented as Xml Elements and not as Xml Empty Elements.  The start-tag and end-tag is “SegmentRef” by default.  The following attribute(s) in the start-tag are:
    1. ID – (Mandatory) Value is the data segment identifier.
    2. Example: 
    3. <SegmentRef Pos="0" ID="GS"  Description="Functional Group Header">

 

  1. Composite data elements are represented as Xml Elements and not as Xml Empty Elements, and must be nested in the data segment Xml Element node that it belongs in.  The start-tag and end-tag is “Composite” by default.  The following attribute(s) in the start-tag are necessary:
    1. ID – (Optional) Value is composite data element identifier.  Not required because identifier is taken from the schema.
    2. POS – (Mandatory) Value is position of composite data element in the data segment.
    3. Example:
    4. <Composite Pos="01" ID="S001" Description="Syntax identifier">

 

  1. Simple data elements are represented as Xml Elements OR Xml Empty Elements, and must be nested in the data segment or composite data element that it belongs in.  The start-tag and end-tag is “Element” by default.  The following attribute(s) in the start-tag are:
    1. ID – (Optional) Value is data element identifier.  Not required because identifier is taken from the schema.
    2. POS – (Mandatory) Value is position of data element in the data segment.
    3. VALUE – (Mandatory) Data element value.  Can be blank for no data.
    4. Example:
    5. <Element Pos="01" ID="0001" Description="Syntax identifier" Type="A" MinLength="4" MaxLength="4" Value="UNOB"/>

      <Element Pos="02" ID="0002" Description="Syntax version number" Type="N" MinLength="1" MaxLength="1" Value="1"/>

 

  1. The data segments Xml element nodes are translated in order of occurrence in the document as defined by the schema, and not necessarily how they are nested in the Xml document.
  2. The data segment, data element, component element terminators are not relevant and are ignored when translating the Xml document, but are necessary when saving to an EDI document binary output.
  3. To specify a different tag name for the data segment, composite data element and simple data element use the Property method in the ediDocument interface.

Samples