EDIFACTReader Component

Properties   Methods   Events   Config Settings   Errors  

The EDIFACTReader component efficiently parses complete EDIFACT transmissions, providing a convenient way to extract and explore data from all included messages.

Syntax

EDISDK.EDIFACTReader

Remarks

The component allows you to parse an incoming EDI document. To parse a document, first, use LoadSchema to load a schema file into the component. Next, select the document you want to process by setting InputFile or InputData and calling Parse.

As the component processes the document, its events will fire and the contents of the document will be available in the Interchange, FunctionalGroup, Message, Segment, Element, and Component properties. The corresponding *Index properties can be thought of as a path within the document. For example, setting the MessageIndex property will cause the SegmentCount property to be updated with the number of segments within the selected message, and then the SegmentIndex property can be used to select one of the segments within that message.

To manage the amount of memory used during processing, the BuildDOM property can be used to select how much of the message will be available in the properties at once:

  • bdEntireDocument - The entire document will be available at once.
  • bdInterchange - Only the current interchange and its contents will be available.
  • bdMessage - Only the current message will be available.
  • bdNone - Only the current segment and its elements will be available.

During parsing, the component performs basic validation of the incoming document. If an error is encountered, the ValidateWarning event will fire.

Property List


The following is the full list of the properties of the component with short descriptions. Click on the links for further details.

AckTypeSpecifies the type of ACK that will be generated by GenerateAck .
BuildDOMControls how much of the document will be stored during parsing.
ComponentThe current component.
ComponentCountThe number of components in the current Element.
ComponentIndexThe index of the current Component.
DelimitersContains the delimiters for the EDI Document.
ElementThe current element.
ElementCountThe number of elements in the current Segment.
ElementIndexThe index of the current Element.
FunctionalGroupThe current FunctionalGroup.
FunctionalGroupCountThe number of FunctionalGroups in the current Interchange.
FunctionalGroupIndexThe index of the current FunctionalGroup.
GroupSpecifies the group to load segments from.
InputDataThe EDI message, specified as a string.
InputFileThe file containing the EDI message.
InterchangeThe current Interchange.
InterchangeCountThe number of Interchanges in the document.
InterchangeIndexThe index of the current Interchange.
MessageThe current message.
MessageCountThe number of message in the current Interchange or FunctionalGroup.
MessageIndexThe index of the current Message.
SegmentThe current segment.
SegmentCountThe number of segments in the current Message.
SegmentIndexThe index of the current segment.
ValidateOnParseWhen True , the component will validate any documents it parses.

Method List


The following is the full list of the methods of the component with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
generateAckGenerates an ACK in response to the most recently parsed message.
getElementValueReturns the value of the element or component at the specified path.
loadSchemaLoads schema information from a file or string data.
parseParse the EDI document and fire parsing events.
resetResets all properties to their default values.
schemaCodeDefines a code value within a list of codes.
schemaCodeListDefines a list of codes.
schemaCompositeDefines a composite element.
schemaElementDefines a simple element.
schemaElementRefAdds a reference to an element in a segment or composite element.
schemaEndEnds a schema definition.
schemaGroupDefines a group of segments.
schemaMessageDefines a message.
schemaSegmentDefines a segment.
schemaSegmentRefAdds a reference to a segment in a message or group.
schemaStartStarts a schema definition.
setInputStreamThe stream containing the EDI data.
validateValidate the EDI document and warn about any errors encountered.

Event List


The following is the full list of the events fired by the component with short descriptions. Click on the links for further details.

EndFunctionalGroupFires at the end of a functional group while parsing.
EndGroupFires at the end of a group while parsing a message.
EndInterchangeFires at the end of an interchange while parsing.
EndMessageFires at the end of a message while parsing.
ErrorFires when an error occurs during message processing. Normally, the component fails with an error.
ResolveSchemaFires whenever a new EDIFACT message is encountered and no schema is found for it.
SegmentFires at the end of a Segment while parsing.
StartFunctionalGroupFires at the beginning of a functional group while parsing.
StartGroupFires at the beginning of a group while parsing a message.
StartInterchangeFires at the beginning of an interchange while parsing.
StartMessageFires at the beginning of a message while parsing.
ValidateWarningFires to warn about validation errors.

Config Settings


The following is a list of config settings for the component with short descriptions. Click on the links for further details.

DelimitersFromUNAA flag indicating if delimiters were read from UNA segment.
InputFormatThe format of the input document.
MaxValidationErrorsThe maximum number of validation errors to return.

AckType Property (EDIFACTReader Component)

Specifies the type of ACK that will be generated by GenerateAck .

Syntax

public int getAckType();
public void setAckType(int ackType);
Enumerated values:
  public final static int atFunctionalCONTRL = 0;

  public final static int atTechnicalCONTRL = 1;

Default Value

0

Remarks

This setting specifies the type of ACK that will be generated when GenerateAck is called. Options include:

Functional CONTRL (atFunctionalCONTRL - 0)A functional CONTRL message. If any syntax errors are encountered when parsing the message, the response will indicate the details of the issue.
Technical CONTRL (atTechnicalCONTRL - 1)A technical CONTRL message, which confirms receipt of the message but not the results of parsing the message.

This property is not available at design time.

BuildDOM Property (EDIFACTReader Component)

Controls how much of the document will be stored during parsing.

Syntax

public int getBuildDOM();
public void setBuildDOM(int buildDOM);
Enumerated values:
  public final static int bdEntireDocument = 0;

  public final static int bdInterchange = 1;

  public final static int bdMessage = 2;

  public final static int bdNone = 3;

Default Value

0

Remarks

This property controls how much of the document will be stored in an internal model during parsing:

0 (bdEntireDocument) The entire document.
1 (bdInterchange) The current interchange.
2 (bdMessage) The current message.
3 (bdNone) No data will be stored and only the events can be used to process the document.

This property is not available at design time.

Component Property (EDIFACTReader Component)

The current component.

Syntax

public EDIElement getComponent();

Remarks

When the current Element is a composite element, this property contains the component specified by ComponentIndex.

This property is read-only and not available at design time.

Please refer to the EDIElement type for a complete list of fields.

ComponentCount Property (EDIFACTReader Component)

The number of components in the current Element.

Syntax

public int getComponentCount();

Default Value

0

Remarks

If the current Element is composite, this property contains the number of components within the element.

This property is read-only and not available at design time.

ComponentIndex Property (EDIFACTReader Component)

The index of the current Component.

Syntax

public int getComponentIndex();
public void setComponentIndex(int componentIndex);

Default Value

1

Remarks

If the current Element is composite, this property is used to specify a Component within the element.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory. You can then use InterchangeIndex, FunctionalGroupIndex, MessageIndex, SegmentIndex, ElementIndex and ComponentIndex to navigate to a specific Component within the parsed document.

This property is not available at design time.

Delimiters Property (EDIFACTReader Component)

Contains the delimiters for the EDI Document.

Syntax

public EDIFACTDelimiters getDelimiters();

Remarks

This property contains the delimiters that will be used when parsing the EDIFACT document. If the document uses delimiters other than the default, change the properties of this object to parse the document correctly.

This property is read-only and not available at design time.

Please refer to the EDIFACTDelimiters type for a complete list of fields.

Element Property (EDIFACTReader Component)

The current element.

Syntax

public EDIElement getElement();

Remarks

This property contains the element within the current Segment specified by ElementIndex.

This property is read-only and not available at design time.

Please refer to the EDIElement type for a complete list of fields.

ElementCount Property (EDIFACTReader Component)

The number of elements in the current Segment.

Syntax

public int getElementCount();

Default Value

0

Remarks

This property contains the number of elements in the current Segment.

This property is read-only and not available at design time.

ElementIndex Property (EDIFACTReader Component)

The index of the current Element.

Syntax

public int getElementIndex();
public void setElementIndex(int elementIndex);

Default Value

1

Remarks

This property is used to specify an Element within the current Segment.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory. You can then use InterchangeIndex, FunctionalGroupIndex, MessageIndex, SegmentIndex and ElementIndex to navigate to specific Element within the parsed document.

This property is not available at design time.

FunctionalGroup Property (EDIFACTReader Component)

The current FunctionalGroup.

Syntax

public EDIFACTFunctionalGroup getFunctionalGroup();

Remarks

This property contains the current FunctionalGroup within the Interchange This property is read-only and not available at design time. Please refer to the FunctionalGroup type for a complete list of fields.

This property is read-only and not available at design time.

Please refer to the EDIFACTFunctionalGroup type for a complete list of fields.

FunctionalGroupCount Property (EDIFACTReader Component)

The number of FunctionalGroups in the current Interchange.

Syntax

public int getFunctionalGroupCount();

Default Value

0

Remarks

This property contains the number of FunctionalGroups in the current Interchange.

This property is read-only and not available at design time.

FunctionalGroupIndex Property (EDIFACTReader Component)

The index of the current FunctionalGroup.

Syntax

public int getFunctionalGroupIndex();
public void setFunctionalGroupIndex(int functionalGroupIndex);

Default Value

1

Remarks

This property is used to specify a FunctionalGroup within the current Interchange.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory, including all interchanges, and functional groups. You can then use InterchangeIndex and FunctionalGroupIndex to navigate to a specific FunctionalGroup within the parsed document.

This property is not available at design time.

Group Property (EDIFACTReader Component)

Specifies the group to load segments from.

Syntax

public String getGroup();
public void setGroup(String group);

Default Value

""

Remarks

When this property is set, only segments from the specified group and iteration will be available through the Segment properties.

A path for a group consists of the name of the group followed by an index indicating the iteration, like this:

reader.Group = "CPSGroup[2]";

If the group is nested inside of another group, the parent and child are connected by a ".":

reader.Group = "CPSGroup[2].LINGroup[2]"; That can be repeated if a group is nested more than one level deep.

This property is not available at design time.

InputData Property (EDIFACTReader Component)

The EDI message, specified as a string.

Syntax

public String getInputData();
public void setInputData(String inputData);

Default Value

""

Remarks

Set this property to specify the input EDI message as a string. The message can then be parsed with Parse.

This property is not available at design time.

InputFile Property (EDIFACTReader Component)

The file containing the EDI message.

Syntax

public String getInputFile();
public void setInputFile(String inputFile);

Default Value

""

Remarks

Set this property to specify a file to read the input EDI message from. The message can then be parsed with Parse.

This property is not available at design time.

Interchange Property (EDIFACTReader Component)

The current Interchange.

Syntax

public EDIFACTInterchange getInterchange();

Remarks

This property contains the current Interchange within the document specified by InterchangeIndex.

This property is read-only and not available at design time.

Please refer to the EDIFACTInterchange type for a complete list of fields.

InterchangeCount Property (EDIFACTReader Component)

The number of Interchanges in the document.

Syntax

public int getInterchangeCount();

Default Value

0

Remarks

This property contains the number of Interchanges in the current document.

This property is read-only and not available at design time.

InterchangeIndex Property (EDIFACTReader Component)

The index of the current Interchange.

Syntax

public int getInterchangeIndex();
public void setInterchangeIndex(int interchangeIndex);

Default Value

1

Remarks

This property is used to specify an Interchange within the document.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory, including all interchanges. You can then use InterchangeIndex to navigate to specific Interchange within the parsed document.

This property is not available at design time.

Message Property (EDIFACTReader Component)

The current message.

Syntax

public EDIFACTMessage getMessage();

Remarks

This property contains the message within the current Interchange or FunctionalGroup specified by MessageIndex.

This property is read-only and not available at design time.

Please refer to the EDIFACTMessage type for a complete list of fields.

MessageCount Property (EDIFACTReader Component)

The number of message in the current Interchange or FunctionalGroup.

Syntax

public int getMessageCount();

Default Value

0

Remarks

This property contains the number of messages in the current Interchange or FunctionalGroup.

This property is read-only and not available at design time.

MessageIndex Property (EDIFACTReader Component)

The index of the current Message.

Syntax

public int getMessageIndex();
public void setMessageIndex(int messageIndex);

Default Value

1

Remarks

This property is used to specify a Message within the current Interchange or FunctionalGroup.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory, including all interchanges, functional groups, and messages. You can then use InterchangeIndex, FunctionalGroupIndex and MessageIndex to navigate to a specific Message within the parsed document.

This property is not available at design time.

Segment Property (EDIFACTReader Component)

The current segment.

Syntax

public EDISegment getSegment();

Remarks

This property contains the segment within the current Message specified by SegmentIndex.

This property is read-only and not available at design time.

Please refer to the EDISegment type for a complete list of fields.

SegmentCount Property (EDIFACTReader Component)

The number of segments in the current Message.

Syntax

public int getSegmentCount();

Default Value

0

Remarks

This property contains the number of elements in the current Message.

This property is read-only and not available at design time.

SegmentIndex Property (EDIFACTReader Component)

The index of the current segment.

Syntax

public int getSegmentIndex();
public void setSegmentIndex(int segmentIndex);

Default Value

1

Remarks

This property is used to specify a Segment within the current Message.

Note: When BuildDOM is set to bdentiredoc, after Parse is called the entire EDI document is parsed and stored in memory. You can then use InterchangeIndex, FunctionalGroupIndex, MessageIndex and SegmentIndex to navigate to specific Segment within the parsed document.

This property is not available at design time.

ValidateOnParse Property (EDIFACTReader Component)

When True , the component will validate any documents it parses.

Syntax

public boolean isValidateOnParse();
public void setValidateOnParse(boolean validateOnParse);

Default Value

False

Remarks

When this property is set to True, the component will perform validation on the document when Parse is called. The ValidateWarning event will fire for each error it encounters.

This property is not available at design time.

Config Method (EDIFACTReader Component)

Sets or retrieves a configuration setting.

Syntax

public String config(String configurationString);

Remarks

Config is a generic method available in every component. It is used to set and retrieve configuration settings for the component.

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

To set a configuration setting named PROPERTY, you must call Config("PROPERTY=VALUE"), where VALUE is the value of the setting expressed as a string. For boolean values, use the strings "True", "False", "0", "1", "Yes", or "No" (case does not matter).

To read (query) the value of a configuration setting, you must call Config("PROPERTY"). The value will be returned as a string.

GenerateAck Method (EDIFACTReader Component)

Generates an ACK in response to the most recently parsed message.

Syntax

public String generateAck();

Remarks

After parsing a message, call this method to generate an ACK that you can send back in response. The type of ACK generated can be controlled by setting the AckType property.

GetElementValue Method (EDIFACTReader Component)

Returns the value of the element or component at the specified path.

Syntax

public String getElementValue(String path);

Remarks

This method returns the value of the element at the specified path. The path starts at the current Message and consists of groups (with indexes to indicate the iteration), a segment tag, and 1-2 indexes to indicate the element or component.

For a simple element the path should include the path to a specific iteration of a group (as in the Group property), followed by a segment tag and an index for the element position within the segment, each separated by a ".":

reader.GetElementValue("CPSGroup[2].LINGroup[2].LIN.1");

When selecting a component of a composite element, the component index should be added after the element index:

reader.GetElementValue("CPSGroup[2].LINGroup[2].QTY.1.2");

LoadSchema Method (EDIFACTReader Component)

Loads schema information from a file or string data.

Syntax

public void loadSchema(String fileOrData, String messageName);

Remarks

This method loads schema information for use when parsing, validating, and translating messages.

The FileOrData parameter can be set to the path of a file containing schema data, or can be set to the contents of a schema file directly.

MessageName can be set to the name of a specific message to load only the specified message's schema information. If left empty or set to "*", the entire schema will be loaded.

Parse Method (EDIFACTReader Component)

Parse the EDI document and fire parsing events.

Syntax

public void parse();

Remarks

This method parses the input EDI document, firing the following events as it parses:

When multiple input sources are specified, only the highest-priority input will be used, in the following order:

  1. SetInputStream
  2. InputFile
  3. InputData

Reset Method (EDIFACTReader Component)

Resets all properties to their default values.

Syntax

public void reset();

Remarks

This method resets all properties of the component to their default values as specified in the property definitions.

SchemaCode Method (EDIFACTReader Component)

Defines a code value within a list of codes.

Syntax

public void schemaCode(String schemaId, String codeListId, String value, String description);

Remarks

Creates a schema definition for a code value within a particular list of codes.

This method can be used when defining a schema instead of loading one from a file.

SchemaCodeList Method (EDIFACTReader Component)

Defines a list of codes.

Syntax

public void schemaCodeList(String schemaId, String codeListId, String description);

Remarks

Creates a schema definition for an empty list of codes. SchemaCode can be used to add code values to the list.

This method can be used when defining a schema instead of loading one from a file.

SchemaComposite Method (EDIFACTReader Component)

Defines a composite element.

Syntax

public void schemaComposite(String schemaId, String compositeId, String description);

Remarks

Creates a schema definition for a composite element. SchemaElementRef can be used to add components to the element.

This method can be used when defining a schema instead of loading one from a file.

SchemaElement Method (EDIFACTReader Component)

Defines a simple element.

Syntax

public void schemaElement(String schemaId, String elementId, String dataType, int minLength, int maxLength, String codeId, String description);

Remarks

Creates a schema definition for a simple element.

This method can be used when defining a schema instead of loading one from a file.

SchemaElementRef Method (EDIFACTReader Component)

Adds a reference to an element in a segment or composite element.

Syntax

public void schemaElementRef(String schemaId, String parentId, String elementId, String refId, boolean required, int maxCount);

Remarks

Adds a reference to an element to the specified parent, which can be the most recently defined segment or composite element.

This method can be used when defining a schema instead of loading one from a file.

SchemaEnd Method (EDIFACTReader Component)

Ends a schema definition.

Syntax

public void schemaEnd();

Remarks

Ends a schema definition when a schema is being defined manually instead of loaded from a file.

SchemaGroup Method (EDIFACTReader Component)

Defines a group of segments.

Syntax

public void schemaGroup(String schemaId, String groupPath, String groupId, boolean required, int maxCount);

Remarks

Creates a schema definition for a group of segments. SchemaSegmentRef can be used to add references to defined segments.

This method can be used when defining a schema instead of loading one from a file.

SchemaMessage Method (EDIFACTReader Component)

Defines a message.

Syntax

public void schemaMessage(String schemaId, String messageId, String description);

Remarks

Creates a schema definition for a message. SchemaSegmentRef and SchemaGroup can be used to add segment references and groups to the message.

This method can be used when defining a schema instead of loading one from a file.

SchemaSegment Method (EDIFACTReader Component)

Defines a segment.

Syntax

public void schemaSegment(String schemaId, String segmentId, String description);

Remarks

Creates a schema definition for a segment. SchemaElementRef can be used to add component references to the segment.

This method can be used when defining a schema instead of loading one from a file.

SchemaSegmentRef Method (EDIFACTReader Component)

Adds a reference to a segment in a message or group.

Syntax

public void schemaSegmentRef(String schemaId, String segmentPath, String segmentId, boolean required, int maxCount);

Remarks

Adds a reference to a segment to the specified path.

This method can be used when defining a schema instead of loading one from a file.

SchemaStart Method (EDIFACTReader Component)

Starts a schema definition.

Syntax

public void schemaStart(String schemaId);

Remarks

Starts manually defining a schema, as an alternative to loading one from a file.

SetInputStream Method (EDIFACTReader Component)

The stream containing the EDI data.

Syntax

public void setInputStream(java.io.InputStream inputStream);

Remarks

Call this method to specify a stream to read the input EDI data from. The data can then be parsed with Parse.

Validate Method (EDIFACTReader Component)

Validate the EDI document and warn about any errors encountered.

Syntax

public void validate();

Remarks

This method parses the input EDI document, firing the ValidateWarning event for any non-blocking errors it encounters.

EndFunctionalGroup Event (EDIFACTReader Component)

Fires at the end of a functional group while parsing.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void endFunctionalGroup(EDIFACTReaderEndFunctionalGroupEvent e) {}
  ...
}

public class EDIFACTReaderEndFunctionalGroupEvent {
  public String tag;

  public int messageCount;

  public String referenceNumber;

}

Remarks

This event fires when the component encounters the end of a functional group while parsing a document.

EndGroup Event (EDIFACTReader Component)

Fires at the end of a group while parsing a message.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void endGroup(EDIFACTReaderEndGroupEvent e) {}
  ...
}

public class EDIFACTReaderEndGroupEvent {
  public String name;

  public int schemaIndex;

}

Remarks

This event fires when the component encounters the end of a group while parsing a message.

EndInterchange Event (EDIFACTReader Component)

Fires at the end of an interchange while parsing.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void endInterchange(EDIFACTReaderEndInterchangeEvent e) {}
  ...
}

public class EDIFACTReaderEndInterchangeEvent {
  public String tag;

  public int groupCount;

  public String referenceNumber;

}

Remarks

This event fires at the end of an interchange while parsing a document.

EndMessage Event (EDIFACTReader Component)

Fires at the end of a message while parsing.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void endMessage(EDIFACTReaderEndMessageEvent e) {}
  ...
}

public class EDIFACTReaderEndMessageEvent {
  public String tag;

  public int segmentCount;

  public String referenceNumber;

}

Remarks

This event fires when the component encounters the end of a message while parsing a document.

Error Event (EDIFACTReader Component)

Fires when an error occurs during message processing. Normally, the component fails with an error.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void error(EDIFACTReaderErrorEvent e) {}
  ...
}

public class EDIFACTReaderErrorEvent {
  public int errorCode;

  public String description;

}

Remarks

The Error event is fired in case of exceptional conditions during message processing. Normally, the component throws an exception.

ConnectionId is the associated client Id, ErrorCode contains an error code, and Description contains a textual description of the error. For a list of valid error codes and their descriptions, please refer to the Error Codes section.

ResolveSchema Event (EDIFACTReader Component)

Fires whenever a new EDIFACT message is encountered and no schema is found for it.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void resolveSchema(EDIFACTReaderResolveSchemaEvent e) {}
  ...
}

public class EDIFACTReaderResolveSchemaEvent {
  public String messageVersion;

  public String messageType;

}

Remarks

This method fires when the component encounters an EDIFACT message it has not loaded a schema for. The parameters of the event can be used to locate the correct schema and load it with LoadSchema.

MessageVersion - The EDIFACT version of the message, such as D97A.

MessageType - The type of message, such as INVOIC.

After the event fires, if the component still doesn't have a matching schema, then it will attempt schema-less parsing of the EDIFACT message.

Segment Event (EDIFACTReader Component)

Fires at the end of a Segment while parsing.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void segment(EDIFACTReaderSegmentEvent e) {}
  ...
}

public class EDIFACTReaderSegmentEvent {
  public String tag;

  public String schemaPath;

  public boolean optional;

  public int elementCount;

  public int schemaIndex;

  public int segmentIndex;

  public int maxCount;

  public String path;

}

Remarks

Fires at the end of a Segment while parsing a document

StartFunctionalGroup Event (EDIFACTReader Component)

Fires at the beginning of a functional group while parsing.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void startFunctionalGroup(EDIFACTReaderStartFunctionalGroupEvent e) {}
  ...
}

public class EDIFACTReaderStartFunctionalGroupEvent {
  public String tag;

  public String appSenderIdentification;

  public String appRecipientIdentification;

  public String dateTime;

  public String referenceNumber;

}

Remarks

This event fires when the component encounters the start of a functional group while parsing a document.

StartGroup Event (EDIFACTReader Component)

Fires at the beginning of a group while parsing a message.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void startGroup(EDIFACTReaderStartGroupEvent e) {}
  ...
}

public class EDIFACTReaderStartGroupEvent {
  public String name;

  public int schemaIndex;

  public int maxCount;

  public String path;

}

Remarks

This event fires when the component encounters the start of a group while parsing a message.

StartInterchange Event (EDIFACTReader Component)

Fires at the beginning of an interchange while parsing.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void startInterchange(EDIFACTReaderStartInterchangeEvent e) {}
  ...
}

public class EDIFACTReaderStartInterchangeEvent {
  public String tag;

  public String syntaxIdentifier;

  public String syntaxVersion;

  public String senderIdentification;

  public String recipientIdentification;

  public String dateTime;

  public String referenceNumber;

}

Remarks

This event fires at the beginning of an interchange while parsing a document.

StartMessage Event (EDIFACTReader Component)

Fires at the beginning of a message while parsing.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void startMessage(EDIFACTReaderStartMessageEvent e) {}
  ...
}

public class EDIFACTReaderStartMessageEvent {
  public String tag;

  public String messageRelease;

  public String messageType;

  public String referenceNumber;

  public boolean schemaLoaded;

}

Remarks

This event fires when the component encounters the start of a message while parsing a document.

ValidateWarning Event (EDIFACTReader Component)

Fires to warn about validation errors.

Syntax

public class DefaultEDIFACTReaderEventListener implements EDIFACTReaderEventListener {
  ...
  public void validateWarning(EDIFACTReaderValidateWarningEvent e) {}
  ...
}

public class EDIFACTReaderValidateWarningEvent {
  public long position;

  public int line;

  public int column;

  public String errorCode;

  public String errorMessage;

  public int errorType;

}

Remarks

When the component encounters a non-blocking error while validating a document, this event fires with information about the error.

EDIElement Type

An element of an EDI document.

Remarks

This represents an element appearing in an EDI document.

The following fields are available:

Fields

DataType
String (read-only)

Default Value: ""

The type of data contained in the element.

Possible values for EDIFACT include:

A The element can only contain alphabetic characters.
AN The element can contain any alphanumeric characters.
N The element can only contain numeric characters.
composite The element is a composite element containing multiple components.

Possible values for X12 include:

AN The element can contain any alphanumeric characters.
ID The element contains an identifier for a code value.
Nn The element contains a numeric integer value.
R The element contains a number with an optional decimal value.
DT The element contains a string representing a date.
TM The element contains a string representing a time.
B The element contains binary data.
composite The element is a composite element containing multiple components.

IsComposite
boolean (read-only)

Default Value: False

Specifies whether the element is a simple or composite element. If true, the element is a composite element that contains other components.

MaxLen
int (read-only)

Default Value: 0

For a simple element, this specifies the maximum length of the element according to the schema.

MinLen
int (read-only)

Default Value: 0

For a simple element, this specifies the minimum length of the element according to the schema.

SchemaDesc
String (read-only)

Default Value: ""

The description of the element as specified in the schema.

SchemaName
String (read-only)

Default Value: ""

The name of the element as specified in the schema.

Value
String (read-only)

Default Value: ""

If the element is a simple element, this field contains its value.

Constructors

public EDIElement();

EDIFACTDelimiters Type

The delimiters used in the EDIFACT document.

Remarks

This type contains fields specifying the various delimiters used within the EDIFACT document.

The following fields are available:

Fields

Component
String

Default Value: ":"

The character used to separate the components in a composite element.

Decimal
String

Default Value: "."

The character used to separate the integer portion of a numeric value from the fractional portion.

Element
String

Default Value: "+"

The delimiter used to separate elements within a segment.

Release
String

Default Value: "?"

The character used to escape other characters within a field. For example, with the default EDIFACT delimiters, "?+" should be considered "+" character that appears within a field, not an element separator.

Repetition
String

Default Value: "*(syntax 4) or empty(syntax 3)"

The character used to indicate a repeating element or component.

Segment
String

Default Value: "'"

The character used to terminate a segment.

Constructors

public EDIFACTDelimiters();

EDIFACTFunctionalGroup Type

A functional group of messages.

Remarks

This type represents a functional group of messages, with fields describing the values from the UNG segment.

The following fields are available:

Fields

AppPassword
String

Default Value: ""

The application password as specified in the functional group header.

This is an alphanumeric field with a value up to 14 characters long.

AppRecipientIdentification
String

Default Value: ""

The name or code of the intended recipient of the message group.

This is an alphanumeric field with a value up to 35 characters long.

AppRecipientIDQualifier
String

Default Value: ""

The qualifier for the recipient's identification (if it contains a code value).

This is an alphanumeric field with a value up to 4 characters long.

AppSenderIdentification
String

Default Value: ""

The name or code of the message group's sender.

This is an alphanumeric field with a value up to 35 characters long.

AppSenderIDQualifier
String

Default Value: ""

The qualifier for the sender's identification (if it contains a code value).

This is an alphanumeric field with a value up to 4 characters long.

AssociationAssignedCode
String

Default Value: ""

The assigned code for the message type.

This is an alphanumeric field with a value up to 6 characters long.

ControllingAgency
String

Default Value: ""

A code value that indicates the agency responsible for maintaining the message specifications.

This is an alphanumeric field with a value up to 3 characters long.

Date
String

Default Value: ""

The date that the group of messages was prepared.

GroupIdentification
String

Default Value: ""

The identification value for the functional group.

This is an alphanumeric field with a value up to 6 characters long.

MessageRelease
String

Default Value: ""

The message release number for the message type appearing in the message group.

This is an alphanumeric field with a value up to 3 characters long.

MessageVersion
String

Default Value: ""

The message version number for message type appearing in the functional group.

This is an alphanumeric field with a value up to 3 characters long.

ReferenceNumber
String

Default Value: ""

The reference number for the functional group.

This is an alphanumeric field with a value up to 14 characters long.

Time
String

Default Value: ""

The time that the group of messages was prepared.

Constructors

public EDIFACTFunctionalGroup();

EDIFACTInterchange Type

An interchange containing functional groups and messages.

Remarks

This type represents an EDIFACT interchange, with fields describing the values from the UNB segment.

The following fields are available:

Fields

AckRequest
String

Default Value: ""

If this field is '1', an ACK was requested in response to this interchange.

AgreementIdentifier
String

Default Value: ""

The identifier for the communication agreement used by the interchange.

This is an alphanumeric field with a value up to 35 characters long.

ApplicationReference
String

Default Value: ""

If the interchange contains only one type of message, this can contain the identifier for the type of message.

This is an alphanumeric field with a value up to 14 characters long.

CharacterEncoding
String

Default Value: ""

The character encoding used by the interchange.

This is an alphanumeric field with a value up to 3 characters long, and is only present for EDIFACT syntax 4.

CodeListVersionNumber
String

Default Value: ""

The identifier for the communication agreement used by the interchange.

This is an alphanumeric field with a value up to 6 characters long.

Date
String

Default Value: ""

The date that the interchange was prepared.

ProcessingPriorityCode
String

Default Value: ""

A 1-character code that requests a specific processing priority for the interchange.

RecipientIdentification
String

Default Value: ""

The identification for the interchange's recipient.

This is an alphanumeric field with a value up to 35 characters long.

RecipientIDQualifier
String

Default Value: ""

The qualifier for the recipient identification code.

This is an alphanumeric field with a value up to 4 characters long.

RecipientInternalIdentification
String

Default Value: ""

More specific recipient identification for internal use.

This is an alphanumeric field with a value up to 35 characters long.

RecipientInternalSubIdentification
String

Default Value: ""

A sub-identification string for the receiver for internal use.

This is an alphanumeric field with a value up to 35 characters long.

RecipientPassword
String

Default Value: ""

A password to be verified by the recipient, such as a system or network password.

This is an alphanumeric field with a value up to 14 characters long.

RecipientPasswordQualifier
String

Default Value: ""

A qualifier for the recipient password.

This is an alphanumeric field with a value up to 2 characters long.

ReferenceNumber
String

Default Value: ""

A reference number for the interchange.

This is an alphanumeric field with a value up to 14 characters long.

SenderIdentification
String

Default Value: ""

The identification for the interchange's sender.

This is an alphanumeric field with a value up to 35 characters long.

SenderIDQualifier
String

Default Value: ""

The qualifier for the sender identification code.

This is an alphanumeric field with a value up to 4 characters long.

SenderInternalIdentification
String

Default Value: ""

More specific sender identification for internal use.

This is an alphanumeric field with a value up to 35 characters long.

SenderInternalSubIdentification
String

Default Value: ""

A sub-identification string for the sender for internal use.

This is an alphanumeric field with a value up to 35 characters long.

SyntaxIdentifier
String

Default Value: ""

A identifier specifying the controlling agency and valid character set.

This is an alphanumeric field with a value up to 4 characters long.

SyntaxVersionNumber
String

Default Value: ""

A 1-character numeric value indicating the syntax version.

TestIndicator
String

Default Value: ""

If this field is '1', the interchange is a test interchange.

Time
String

Default Value: ""

The time that the interchange was prepared.

Constructors

public EDIFACTInterchange();

EDIFACTMessage Type

An EDIFACT message.

Remarks

This type represents an EDIFACT message, with fields describing the values from the UNH segment.

The following fields are available:

Fields

AssociationAssignedCode
String

Default Value: ""

A code assigned to the message by the controlling organization.

This is an alphanumeric field with a value up to 6 characters long.

CodeListVersionNumber
String

Default Value: ""

The version number of the code list that should be used.

This is an alphanumeric field with a value up to 6 characters long. This field only appears in EDIFACT syntax version 4.

CommonAccessReference
String

Default Value: ""

A reference value to associate this message with related messages.

This is an alphanumeric field with a value up to 35 characters long.

ControllingAgency
String

Default Value: ""

A code that identifies the controlling agency for this message type.

This is an alphanumeric field with a value up to 3 characters long.

FirstAndLastTransfer
String

Default Value: ""

A single-character field that indicates the first and last messages in a related set.

MessageImplControllingAgency
String

Default Value: ""

A code value that identifies the controlling agency for the message implementation.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

MessageImplIdentification
String

Default Value: ""

Identifies the message implementation.

This is an alphanumeric field with a value up to 14 characters long. This field only appears in EDIFACT syntax version 4.

MessageImplRelease
String

Default Value: ""

Identifies the release number for the message implementation.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

MessageImplVersion
String

Default Value: ""

Identifies the version number for the message implementation.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

MessageRelease
String

Default Value: ""

Identifies the release number for the message.

This is an alphanumeric field with a value up to 3 characters long.

MessageSubsetControllingAgency
String

Default Value: ""

A code value that identifies the controlling agency for the message subset.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

MessageSubsetIdentification
String

Default Value: ""

Identifies the message subset.

This is an alphanumeric field with a value up to 14 characters long. This field only appears in EDIFACT syntax version 4.

MessageSubsetRelease
String

Default Value: ""

Identifies the release number for the message subset.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

MessageSubsetVersion
String

Default Value: ""

Identifies the version number for the message subset.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

MessageType
String

Default Value: ""

A code identifying the message's type.

This is an alphanumeric field with a value up to 6 characters long.

MessageTypeSubFunctionIdentification
String

Default Value: ""

A code identifying the sub-function of the message's type.

This is an alphanumeric field with a value up to 6 characters long. This field only appears in EDIFACT syntax version 4.

MessageVersion
String

Default Value: ""

Identifies the version number for the message.

This is an alphanumeric field with a value up to 3 characters long.

ReferenceNumber
String

Default Value: ""

A unique reference number for the message.

This is an alphanumeric field with a value up to 14 characters long.

ScenarioControllingAgency
String

Default Value: ""

Identifies the controlling agency for the message scenario.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

ScenarioIdentification
String

Default Value: ""

The identifier for the message scenario.

This is an alphanumeric field with a value up to 14 characters long. This field only appears in EDIFACT syntax version 4.

ScenarioRelease
String

Default Value: ""

The message scenario's release number.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

ScenarioVersion
String

Default Value: ""

The message scenario's version number.

This is an alphanumeric field with a value up to 3 characters long. This field only appears in EDIFACT syntax version 4.

SequenceOfTransfers
String

Default Value: ""

Specifies the message's position in a sequence.

This is an alphanumeric field with a value up to 2 characters long.

Constructors

public EDIFACTMessage();

EDISegment Type

A segment of an EDI document.

Remarks

This represents a segment appearing in an EDI document.

The following fields are available:

Fields

Optional
boolean (read-only)

Default Value: False

Specifies whether the segment is required or optional. If true, the element is optional.

Path
String (read-only)

Default Value: ""

Contains the path to the segment, including the groups that the segment is contained in.

SchemaPath
String (read-only)

Default Value: ""

Contains a numeric representation of the path to the segment, using the indexes within the schema, such as \4[3]\5[6]\7[8].

Tag
String (read-only)

Default Value: ""

The tag of the segment, such as BGM, DTM, FTX, etc.

Constructors

public EDISegment();

Config Settings (EDIFACTReader Component)

The component accepts one or more of the following configuration settings. Configuration settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the component, access to these internal properties is provided through the Config method.

EDIFACTReader Config Settings

DelimitersFromUNA:   A flag indicating if delimiters were read from UNA segment.

This setting controls whether delimiters were read from the UNA segment. The default value is false. This configuration setting is read-only.

InputFormat:   The format of the input document.

This setting controls the type of input document for parsing. Possible values are:

0 (default)EDIFACT
1XML
MaxValidationErrors:   The maximum number of validation errors to return.

This setting controls the maximum number of validation errors that will be returned during the validation process. The default value is 200.

Trappable Errors (EDIFACTReader Component)

EDIFACTReader Errors

202   Invalid argument.
304   Cannot write to file.
1003   Could not find the selected schema in the chosen file.
1099   Encountered an unexpected segment tag.
1100   Attempted to perform an action while the component was busy, or close an incomplete interchange.
1044   Tried to load an invalid schema file.
1201   The index is out of range.
1202   The selected ACK type is invalid.
1203   Encountered an error while validating the UNA segment.