EDIFACTReader Class

Properties   Methods   Events   Config Settings   Errors  

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

Syntax

class edisdk.EDIFACTReader

Remarks

The class allows you to parse an incoming EDI document. To parse a document, first, use load_schema to load a schema file into the class. Next, select the document you want to process by setting input_file or input_data and calling parse.

As the class processes the document, its events will fire and the contents of the document will be available in the interchange, functional_group, 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 build_dom 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 class performs basic validation of the incoming document. If an error is encountered, the on_validate_warning event will fire.

Property List


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

ack_typeSpecifies the type of ACK that will be generated by GenerateAck .
build_domControls how much of the document will be stored during parsing.
component_data_typeThe type of data contained in the element.
component_is_compositeSpecifies whether the element is a simple or composite element.
component_max_lenFor a simple element, this specifies the maximum length of the element according to the schema.
component_min_lenFor a simple element, this specifies the minimum length of the element according to the schema.
component_schema_descThe description of the element as specified in the schema.
component_schema_nameThe name of the element as specified in the schema.
component_valueIf the element is a simple element, this property contains its value.
component_countThe number of classes in the current Element.
component_indexThe index of the current Class.
delimiter_componentThe character used to separate the classes in a composite element.
delimiter_decimalThe character used to separate the integer portion of a numeric value from the fractional portion.
delimiter_elementThe delimiter used to separate elements within a segment.
delimiter_releaseThe character used to escape other characters within a property.
delimiter_repetitionThe character used to indicate a repeating element or class.
delimiter_segmentThe character used to terminate a segment.
element_data_typeThe type of data contained in the element.
element_is_compositeSpecifies whether the element is a simple or composite element.
element_max_lenFor a simple element, this specifies the maximum length of the element according to the schema.
element_min_lenFor a simple element, this specifies the minimum length of the element according to the schema.
element_schema_descThe description of the element as specified in the schema.
element_schema_nameThe name of the element as specified in the schema.
element_valueIf the element is a simple element, this property contains its value.
element_countThe number of elements in the current Segment.
element_indexThe index of the current Element.
f_group_app_passwordThe application password as specified in the functional group header.
f_group_app_recipient_identificationThe name or code of the intended recipient of the message group.
f_group_app_recipient_id_qualifierThe qualifier for the recipient's identification (if it contains a code value).
f_group_app_sender_identificationThe name or code of the message group's sender.
f_group_app_sender_id_qualifierThe qualifier for the sender's identification (if it contains a code value).
f_group_association_assigned_codeThe assigned code for the message type.
f_group_controlling_agencyA code value that indicates the agency responsible for maintaining the message specifications.
f_group_dateThe date that the group of messages was prepared.
f_group_group_identificationThe identification value for the functional group.
f_group_message_releaseThe message release number for the message type appearing in the message group.
f_group_message_versionThe message version number for message type appearing in the functional group.
f_group_reference_numberThe reference number for the functional group.
f_group_timeThe time that the group of messages was prepared.
functional_group_countThe number of FunctionalGroups in the current Interchange.
functional_group_indexThe index of the current FunctionalGroup.
groupSpecifies the group to load segments from.
input_dataThe EDI message, specified as a string.
input_fileThe file containing the EDI message.
interchange_ack_requestIf this property is '1', an ACK was requested in response to this interchange.
interchange_agreement_identifierThe identifier for the communication agreement used by the interchange.
interchange_application_referenceIf the interchange contains only one type of message, this can contain the identifier for the type of message.
interchange_character_encodingThe character encoding used by the interchange.
interchange_code_list_version_numberThe identifier for the communication agreement used by the interchange.
interchange_dateThe date that the interchange was prepared.
interchange_processing_priority_codeA 1-character code that requests a specific processing priority for the interchange.
interchange_recipient_identificationThe identification for the interchange's recipient.
interchange_recipient_id_qualifierThe qualifier for the recipient identification code.
interchange_recipient_internal_identificationMore specific recipient identification for internal use.
interchange_recipient_internal_sub_identificationA sub-identification string for the receiver for internal use.
interchange_recipient_passwordA password to be verified by the recipient, such as a system or network password.
interchange_recipient_password_qualifierA qualifier for the recipient password.
interchange_reference_numberA reference number for the interchange.
interchange_sender_identificationThe identification for the interchange's sender.
interchange_sender_id_qualifierThe qualifier for the sender identification code.
interchange_sender_internal_identificationMore specific sender identification for internal use.
interchange_sender_internal_sub_identificationA sub-identification string for the sender for internal use.
interchange_syntax_identifierA identifier specifying the controlling agency and valid character set.
interchange_syntax_version_numberA 1-character numeric value indicating the syntax version.
interchange_test_indicatorIf this property is '1', the interchange is a test interchange.
interchange_timeThe time that the interchange was prepared.
interchange_countThe number of Interchanges in the document.
interchange_indexThe index of the current Interchange.
msg_association_assigned_codeA code assigned to the message by the controlling organization.
msg_code_list_version_numberThe version number of the code list that should be used.
msg_common_access_referenceA reference value to associate this message with related messages.
msg_controlling_agencyA code that identifies the controlling agency for this message type.
msg_first_and_last_transferA single-character property that indicates the first and last messages in a related set.
msg_message_impl_controlling_agencyA code value that identifies the controlling agency for the message implementation.
msg_message_impl_identificationIdentifies the message implementation.
msg_message_impl_releaseIdentifies the release number for the message implementation.
msg_message_impl_versionIdentifies the version number for the message implementation.
msg_message_releaseIdentifies the release number for the message.
msg_message_subset_controlling_agencyA code value that identifies the controlling agency for the message subset.
msg_message_subset_identificationIdentifies the message subset.
msg_message_subset_releaseIdentifies the release number for the message subset.
msg_message_subset_versionIdentifies the version number for the message subset.
msg_message_typeA code identifying the message's type.
msg_message_type_sub_function_identificationA code identifying the sub-function of the message's type.
msg_message_versionIdentifies the version number for the message.
msg_reference_numberA unique reference number for the message.
msg_scenario_controlling_agencyIdentifies the controlling agency for the message scenario.
msg_scenario_identificationThe identifier for the message scenario.
msg_scenario_releaseThe message scenario's release number.
msg_scenario_versionThe message scenario's version number.
msg_sequence_of_transfersSpecifies the message's position in a sequence.
message_countThe number of message in the current Interchange or FunctionalGroup.
message_indexThe index of the current Message.
segment_optionalSpecifies whether the segment is required or optional.
segment_pathContains the path to the segment, including the groups that the segment is contained in.
segment_schema_pathContains a numeric representation of the path to the segment, using the indexes within the schema, such as \\4[3]\\5[6]\\7[8] .
segment_tagThe tag of the segment, such as BGM , DTM , FTX , etc.
segment_countThe number of segments in the current Message.
segment_indexThe index of the current segment.
validate_on_parseWhen True , the class will validate any documents it parses.

Method List


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

configSets or retrieves a configuration setting.
generate_ackGenerates an ACK in response to the most recently parsed message.
get_element_valueReturns the value of the element or class at the specified path.
load_schemaLoads schema information from a file or string data.
parseParse the EDI document and fire parsing events.
resetResets all properties to their default values.
schema_codeDefines a code value within a list of codes.
schema_code_listDefines a list of codes.
schema_compositeDefines a composite element.
schema_elementDefines a simple element.
schema_element_refAdds a reference to an element in a segment or composite element.
schema_endEnds a schema definition.
schema_groupDefines a group of segments.
schema_messageDefines a message.
schema_segmentDefines a segment.
schema_segment_refAdds a reference to a segment in a message or group.
schema_startStarts a schema definition.
validateValidate the EDI document and warn about any errors encountered.

Event List


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

on_end_functional_groupFires at the end of a functional group while parsing.
on_end_groupFires at the end of a group while parsing a message.
on_end_interchangeFires at the end of an interchange while parsing.
on_end_messageFires at the end of a message while parsing.
on_errorFires when an error occurs during message processing. Normally, the class fails with an error.
on_resolve_schemaFires whenever a new EDIFACT message is encountered and no schema is found for it.
on_segmentFires at the end of a Segment while parsing.
on_start_functional_groupFires at the beginning of a functional group while parsing.
on_start_groupFires at the beginning of a group while parsing a message.
on_start_interchangeFires at the beginning of an interchange while parsing.
on_start_messageFires at the beginning of a message while parsing.
on_validate_warningFires to warn about validation errors.

Config Settings


The following is a list of config settings for the class 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.

ack_type property

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

Syntax

def get_ack_type() -> int: ...
def set_ack_type(value: int) -> None: ...

ack_type = property(get_ack_type, set_ack_type)

Possible Values

0   # FunctionalCONTRL
1 # TechnicalCONTRL

Default Value

0

Remarks

This setting specifies the type of ACK that will be generated when generate_ack 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.

build_dom property

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

Syntax

def get_build_dom() -> int: ...
def set_build_dom(value: int) -> None: ...

build_dom = property(get_build_dom, set_build_dom)

Possible Values

0   # EntireDocument
1 # Interchange
2 # Message
3 # None

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.

component_data_type property

The type of data contained in the element.

Syntax

def get_component_data_type() -> str: ...

component_data_type = property(get_component_data_type, None)

Default Value

""

Remarks

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.

This property is read-only.

component_is_composite property

Specifies whether the element is a simple or composite element.

Syntax

def get_component_is_composite() -> bool: ...

component_is_composite = property(get_component_is_composite, None)

Default Value

FALSE

Remarks

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

This property is read-only.

component_max_len property

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

Syntax

def get_component_max_len() -> int: ...

component_max_len = property(get_component_max_len, None)

Default Value

0

Remarks

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

This property is read-only.

component_min_len property

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

Syntax

def get_component_min_len() -> int: ...

component_min_len = property(get_component_min_len, None)

Default Value

0

Remarks

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

This property is read-only.

component_schema_desc property

The description of the element as specified in the schema.

Syntax

def get_component_schema_desc() -> str: ...

component_schema_desc = property(get_component_schema_desc, None)

Default Value

""

Remarks

The description of the element as specified in the schema.

This property is read-only.

component_schema_name property

The name of the element as specified in the schema.

Syntax

def get_component_schema_name() -> str: ...

component_schema_name = property(get_component_schema_name, None)

Default Value

""

Remarks

The name of the element as specified in the schema.

This property is read-only.

component_value property

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

Syntax

def get_component_value() -> str: ...

component_value = property(get_component_value, None)

Default Value

""

Remarks

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

This property is read-only.

component_count property

The number of classes in the current Element.

Syntax

def get_component_count() -> int: ...

component_count = property(get_component_count, None)

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.

component_index property

The index of the current Class.

Syntax

def get_component_index() -> int: ...
def set_component_index(value: int) -> None: ...

component_index = property(get_component_index, set_component_index)

Default Value

1

Remarks

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

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory. You can then use interchange_index, functional_group_index, message_index, segment_index, element_index and ComponentIndex to navigate to a specific component within the parsed document.

delimiter_component property

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

Syntax

def get_delimiter_component() -> str: ...
def set_delimiter_component(value: str) -> None: ...

delimiter_component = property(get_delimiter_component, set_delimiter_component)

Default Value

":"

Remarks

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

delimiter_decimal property

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

Syntax

def get_delimiter_decimal() -> str: ...
def set_delimiter_decimal(value: str) -> None: ...

delimiter_decimal = property(get_delimiter_decimal, set_delimiter_decimal)

Default Value

"."

Remarks

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

delimiter_element property

The delimiter used to separate elements within a segment.

Syntax

def get_delimiter_element() -> str: ...
def set_delimiter_element(value: str) -> None: ...

delimiter_element = property(get_delimiter_element, set_delimiter_element)

Default Value

"+"

Remarks

The delimiter used to separate elements within a segment.

delimiter_release property

The character used to escape other characters within a property.

Syntax

def get_delimiter_release() -> str: ...
def set_delimiter_release(value: str) -> None: ...

delimiter_release = property(get_delimiter_release, set_delimiter_release)

Default Value

"?"

Remarks

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.

delimiter_repetition property

The character used to indicate a repeating element or class.

Syntax

def get_delimiter_repetition() -> str: ...
def set_delimiter_repetition(value: str) -> None: ...

delimiter_repetition = property(get_delimiter_repetition, set_delimiter_repetition)

Default Value

"*(syntax 4) or empty(syntax 3)"

Remarks

The character used to indicate a repeating element or component.

delimiter_segment property

The character used to terminate a segment.

Syntax

def get_delimiter_segment() -> str: ...
def set_delimiter_segment(value: str) -> None: ...

delimiter_segment = property(get_delimiter_segment, set_delimiter_segment)

Default Value

"'"

Remarks

The character used to terminate a segment.

element_data_type property

The type of data contained in the element.

Syntax

def get_element_data_type() -> str: ...

element_data_type = property(get_element_data_type, None)

Default Value

""

Remarks

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.

This property is read-only.

element_is_composite property

Specifies whether the element is a simple or composite element.

Syntax

def get_element_is_composite() -> bool: ...

element_is_composite = property(get_element_is_composite, None)

Default Value

FALSE

Remarks

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

This property is read-only.

element_max_len property

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

Syntax

def get_element_max_len() -> int: ...

element_max_len = property(get_element_max_len, None)

Default Value

0

Remarks

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

This property is read-only.

element_min_len property

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

Syntax

def get_element_min_len() -> int: ...

element_min_len = property(get_element_min_len, None)

Default Value

0

Remarks

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

This property is read-only.

element_schema_desc property

The description of the element as specified in the schema.

Syntax

def get_element_schema_desc() -> str: ...

element_schema_desc = property(get_element_schema_desc, None)

Default Value

""

Remarks

The description of the element as specified in the schema.

This property is read-only.

element_schema_name property

The name of the element as specified in the schema.

Syntax

def get_element_schema_name() -> str: ...

element_schema_name = property(get_element_schema_name, None)

Default Value

""

Remarks

The name of the element as specified in the schema.

This property is read-only.

element_value property

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

Syntax

def get_element_value() -> str: ...

element_value = property(get_element_value, None)

Default Value

""

Remarks

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

This property is read-only.

element_count property

The number of elements in the current Segment.

Syntax

def get_element_count() -> int: ...

element_count = property(get_element_count, None)

Default Value

0

Remarks

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

This property is read-only.

element_index property

The index of the current Element.

Syntax

def get_element_index() -> int: ...
def set_element_index(value: int) -> None: ...

element_index = property(get_element_index, set_element_index)

Default Value

1

Remarks

This property is used to specify an element within the current segment.

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory. You can then use interchange_index, functional_group_index, message_index, segment_index and ElementIndex to navigate to specific element within the parsed document.

f_group_app_password property

The application password as specified in the functional group header.

Syntax

def get_f_group_app_password() -> str: ...
def set_f_group_app_password(value: str) -> None: ...

f_group_app_password = property(get_f_group_app_password, set_f_group_app_password)

Default Value

""

Remarks

The application password as specified in the functional group header.

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

f_group_app_recipient_identification property

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

Syntax

def get_f_group_app_recipient_identification() -> str: ...
def set_f_group_app_recipient_identification(value: str) -> None: ...

f_group_app_recipient_identification = property(get_f_group_app_recipient_identification, set_f_group_app_recipient_identification)

Default Value

""

Remarks

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.

f_group_app_recipient_id_qualifier property

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

Syntax

def get_f_group_app_recipient_id_qualifier() -> str: ...
def set_f_group_app_recipient_id_qualifier(value: str) -> None: ...

f_group_app_recipient_id_qualifier = property(get_f_group_app_recipient_id_qualifier, set_f_group_app_recipient_id_qualifier)

Default Value

""

Remarks

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.

f_group_app_sender_identification property

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

Syntax

def get_f_group_app_sender_identification() -> str: ...
def set_f_group_app_sender_identification(value: str) -> None: ...

f_group_app_sender_identification = property(get_f_group_app_sender_identification, set_f_group_app_sender_identification)

Default Value

""

Remarks

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

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

f_group_app_sender_id_qualifier property

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

Syntax

def get_f_group_app_sender_id_qualifier() -> str: ...
def set_f_group_app_sender_id_qualifier(value: str) -> None: ...

f_group_app_sender_id_qualifier = property(get_f_group_app_sender_id_qualifier, set_f_group_app_sender_id_qualifier)

Default Value

""

Remarks

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.

f_group_association_assigned_code property

The assigned code for the message type.

Syntax

def get_f_group_association_assigned_code() -> str: ...
def set_f_group_association_assigned_code(value: str) -> None: ...

f_group_association_assigned_code = property(get_f_group_association_assigned_code, set_f_group_association_assigned_code)

Default Value

""

Remarks

The assigned code for the message type.

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

f_group_controlling_agency property

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

Syntax

def get_f_group_controlling_agency() -> str: ...
def set_f_group_controlling_agency(value: str) -> None: ...

f_group_controlling_agency = property(get_f_group_controlling_agency, set_f_group_controlling_agency)

Default Value

""

Remarks

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.

f_group_date property

The date that the group of messages was prepared.

Syntax

def get_f_group_date() -> str: ...
def set_f_group_date(value: str) -> None: ...

f_group_date = property(get_f_group_date, set_f_group_date)

Default Value

""

Remarks

The date that the group of messages was prepared.

f_group_group_identification property

The identification value for the functional group.

Syntax

def get_f_group_group_identification() -> str: ...
def set_f_group_group_identification(value: str) -> None: ...

f_group_group_identification = property(get_f_group_group_identification, set_f_group_group_identification)

Default Value

""

Remarks

The identification value for the functional group.

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

f_group_message_release property

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

Syntax

def get_f_group_message_release() -> str: ...
def set_f_group_message_release(value: str) -> None: ...

f_group_message_release = property(get_f_group_message_release, set_f_group_message_release)

Default Value

""

Remarks

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.

f_group_message_version property

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

Syntax

def get_f_group_message_version() -> str: ...
def set_f_group_message_version(value: str) -> None: ...

f_group_message_version = property(get_f_group_message_version, set_f_group_message_version)

Default Value

""

Remarks

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.

f_group_reference_number property

The reference number for the functional group.

Syntax

def get_f_group_reference_number() -> str: ...
def set_f_group_reference_number(value: str) -> None: ...

f_group_reference_number = property(get_f_group_reference_number, set_f_group_reference_number)

Default Value

""

Remarks

The reference number for the functional group.

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

f_group_time property

The time that the group of messages was prepared.

Syntax

def get_f_group_time() -> str: ...
def set_f_group_time(value: str) -> None: ...

f_group_time = property(get_f_group_time, set_f_group_time)

Default Value

""

Remarks

The time that the group of messages was prepared.

functional_group_count property

The number of FunctionalGroups in the current Interchange.

Syntax

def get_functional_group_count() -> int: ...

functional_group_count = property(get_functional_group_count, None)

Default Value

0

Remarks

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

This property is read-only.

functional_group_index property

The index of the current FunctionalGroup.

Syntax

def get_functional_group_index() -> int: ...
def set_functional_group_index(value: int) -> None: ...

functional_group_index = property(get_functional_group_index, set_functional_group_index)

Default Value

1

Remarks

This property is used to specify a functional_group within the current interchange.

Note: When build_dom 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 interchange_index and FunctionalGroupIndex to navigate to a specific functional_group within the parsed document.

group property

Specifies the group to load segments from.

Syntax

def get_group() -> str: ...
def set_group(value: str) -> None: ...

group = property(get_group, set_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.

input_data property

The EDI message, specified as a string.

Syntax

def get_input_data() -> str: ...
def set_input_data(value: str) -> None: ...

input_data = property(get_input_data, set_input_data)

Default Value

""

Remarks

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

input_file property

The file containing the EDI message.

Syntax

def get_input_file() -> str: ...
def set_input_file(value: str) -> None: ...

input_file = property(get_input_file, set_input_file)

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.

interchange_ack_request property

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

Syntax

def get_interchange_ack_request() -> str: ...
def set_interchange_ack_request(value: str) -> None: ...

interchange_ack_request = property(get_interchange_ack_request, set_interchange_ack_request)

Default Value

""

Remarks

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

interchange_agreement_identifier property

The identifier for the communication agreement used by the interchange.

Syntax

def get_interchange_agreement_identifier() -> str: ...
def set_interchange_agreement_identifier(value: str) -> None: ...

interchange_agreement_identifier = property(get_interchange_agreement_identifier, set_interchange_agreement_identifier)

Default Value

""

Remarks

The identifier for the communication agreement used by the interchange.

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

interchange_application_reference property

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

Syntax

def get_interchange_application_reference() -> str: ...
def set_interchange_application_reference(value: str) -> None: ...

interchange_application_reference = property(get_interchange_application_reference, set_interchange_application_reference)

Default Value

""

Remarks

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.

interchange_character_encoding property

The character encoding used by the interchange.

Syntax

def get_interchange_character_encoding() -> str: ...
def set_interchange_character_encoding(value: str) -> None: ...

interchange_character_encoding = property(get_interchange_character_encoding, set_interchange_character_encoding)

Default Value

""

Remarks

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.

interchange_code_list_version_number property

The identifier for the communication agreement used by the interchange.

Syntax

def get_interchange_code_list_version_number() -> str: ...
def set_interchange_code_list_version_number(value: str) -> None: ...

interchange_code_list_version_number = property(get_interchange_code_list_version_number, set_interchange_code_list_version_number)

Default Value

""

Remarks

The identifier for the communication agreement used by the interchange.

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

interchange_date property

The date that the interchange was prepared.

Syntax

def get_interchange_date() -> str: ...
def set_interchange_date(value: str) -> None: ...

interchange_date = property(get_interchange_date, set_interchange_date)

Default Value

""

Remarks

The date that the interchange was prepared.

interchange_processing_priority_code property

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

Syntax

def get_interchange_processing_priority_code() -> str: ...
def set_interchange_processing_priority_code(value: str) -> None: ...

interchange_processing_priority_code = property(get_interchange_processing_priority_code, set_interchange_processing_priority_code)

Default Value

""

Remarks

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

interchange_recipient_identification property

The identification for the interchange's recipient.

Syntax

def get_interchange_recipient_identification() -> str: ...
def set_interchange_recipient_identification(value: str) -> None: ...

interchange_recipient_identification = property(get_interchange_recipient_identification, set_interchange_recipient_identification)

Default Value

""

Remarks

The identification for the interchange's recipient.

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

interchange_recipient_id_qualifier property

The qualifier for the recipient identification code.

Syntax

def get_interchange_recipient_id_qualifier() -> str: ...
def set_interchange_recipient_id_qualifier(value: str) -> None: ...

interchange_recipient_id_qualifier = property(get_interchange_recipient_id_qualifier, set_interchange_recipient_id_qualifier)

Default Value

""

Remarks

The qualifier for the recipient identification code.

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

interchange_recipient_internal_identification property

More specific recipient identification for internal use.

Syntax

def get_interchange_recipient_internal_identification() -> str: ...
def set_interchange_recipient_internal_identification(value: str) -> None: ...

interchange_recipient_internal_identification = property(get_interchange_recipient_internal_identification, set_interchange_recipient_internal_identification)

Default Value

""

Remarks

More specific recipient identification for internal use.

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

interchange_recipient_internal_sub_identification property

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

Syntax

def get_interchange_recipient_internal_sub_identification() -> str: ...
def set_interchange_recipient_internal_sub_identification(value: str) -> None: ...

interchange_recipient_internal_sub_identification = property(get_interchange_recipient_internal_sub_identification, set_interchange_recipient_internal_sub_identification)

Default Value

""

Remarks

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

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

interchange_recipient_password property

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

Syntax

def get_interchange_recipient_password() -> str: ...
def set_interchange_recipient_password(value: str) -> None: ...

interchange_recipient_password = property(get_interchange_recipient_password, set_interchange_recipient_password)

Default Value

""

Remarks

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.

interchange_recipient_password_qualifier property

A qualifier for the recipient password.

Syntax

def get_interchange_recipient_password_qualifier() -> str: ...
def set_interchange_recipient_password_qualifier(value: str) -> None: ...

interchange_recipient_password_qualifier = property(get_interchange_recipient_password_qualifier, set_interchange_recipient_password_qualifier)

Default Value

""

Remarks

A qualifier for the recipient password.

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

interchange_reference_number property

A reference number for the interchange.

Syntax

def get_interchange_reference_number() -> str: ...
def set_interchange_reference_number(value: str) -> None: ...

interchange_reference_number = property(get_interchange_reference_number, set_interchange_reference_number)

Default Value

""

Remarks

A reference number for the interchange.

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

interchange_sender_identification property

The identification for the interchange's sender.

Syntax

def get_interchange_sender_identification() -> str: ...
def set_interchange_sender_identification(value: str) -> None: ...

interchange_sender_identification = property(get_interchange_sender_identification, set_interchange_sender_identification)

Default Value

""

Remarks

The identification for the interchange's sender.

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

interchange_sender_id_qualifier property

The qualifier for the sender identification code.

Syntax

def get_interchange_sender_id_qualifier() -> str: ...
def set_interchange_sender_id_qualifier(value: str) -> None: ...

interchange_sender_id_qualifier = property(get_interchange_sender_id_qualifier, set_interchange_sender_id_qualifier)

Default Value

""

Remarks

The qualifier for the sender identification code.

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

interchange_sender_internal_identification property

More specific sender identification for internal use.

Syntax

def get_interchange_sender_internal_identification() -> str: ...
def set_interchange_sender_internal_identification(value: str) -> None: ...

interchange_sender_internal_identification = property(get_interchange_sender_internal_identification, set_interchange_sender_internal_identification)

Default Value

""

Remarks

More specific sender identification for internal use.

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

interchange_sender_internal_sub_identification property

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

Syntax

def get_interchange_sender_internal_sub_identification() -> str: ...
def set_interchange_sender_internal_sub_identification(value: str) -> None: ...

interchange_sender_internal_sub_identification = property(get_interchange_sender_internal_sub_identification, set_interchange_sender_internal_sub_identification)

Default Value

""

Remarks

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

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

interchange_syntax_identifier property

A identifier specifying the controlling agency and valid character set.

Syntax

def get_interchange_syntax_identifier() -> str: ...
def set_interchange_syntax_identifier(value: str) -> None: ...

interchange_syntax_identifier = property(get_interchange_syntax_identifier, set_interchange_syntax_identifier)

Default Value

""

Remarks

A identifier specifying the controlling agency and valid character set.

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

interchange_syntax_version_number property

A 1-character numeric value indicating the syntax version.

Syntax

def get_interchange_syntax_version_number() -> str: ...
def set_interchange_syntax_version_number(value: str) -> None: ...

interchange_syntax_version_number = property(get_interchange_syntax_version_number, set_interchange_syntax_version_number)

Default Value

""

Remarks

A 1-character numeric value indicating the syntax version.

interchange_test_indicator property

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

Syntax

def get_interchange_test_indicator() -> str: ...
def set_interchange_test_indicator(value: str) -> None: ...

interchange_test_indicator = property(get_interchange_test_indicator, set_interchange_test_indicator)

Default Value

""

Remarks

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

interchange_time property

The time that the interchange was prepared.

Syntax

def get_interchange_time() -> str: ...
def set_interchange_time(value: str) -> None: ...

interchange_time = property(get_interchange_time, set_interchange_time)

Default Value

""

Remarks

The time that the interchange was prepared.

interchange_count property

The number of Interchanges in the document.

Syntax

def get_interchange_count() -> int: ...

interchange_count = property(get_interchange_count, None)

Default Value

0

Remarks

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

This property is read-only.

interchange_index property

The index of the current Interchange.

Syntax

def get_interchange_index() -> int: ...
def set_interchange_index(value: int) -> None: ...

interchange_index = property(get_interchange_index, set_interchange_index)

Default Value

1

Remarks

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

Note: When build_dom 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.

msg_association_assigned_code property

A code assigned to the message by the controlling organization.

Syntax

def get_msg_association_assigned_code() -> str: ...
def set_msg_association_assigned_code(value: str) -> None: ...

msg_association_assigned_code = property(get_msg_association_assigned_code, set_msg_association_assigned_code)

Default Value

""

Remarks

A code assigned to the message by the controlling organization.

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

msg_code_list_version_number property

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

Syntax

def get_msg_code_list_version_number() -> str: ...
def set_msg_code_list_version_number(value: str) -> None: ...

msg_code_list_version_number = property(get_msg_code_list_version_number, set_msg_code_list_version_number)

Default Value

""

Remarks

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.

msg_common_access_reference property

A reference value to associate this message with related messages.

Syntax

def get_msg_common_access_reference() -> str: ...
def set_msg_common_access_reference(value: str) -> None: ...

msg_common_access_reference = property(get_msg_common_access_reference, set_msg_common_access_reference)

Default Value

""

Remarks

A reference value to associate this message with related messages.

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

msg_controlling_agency property

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

Syntax

def get_msg_controlling_agency() -> str: ...
def set_msg_controlling_agency(value: str) -> None: ...

msg_controlling_agency = property(get_msg_controlling_agency, set_msg_controlling_agency)

Default Value

""

Remarks

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

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

msg_first_and_last_transfer property

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

Syntax

def get_msg_first_and_last_transfer() -> str: ...
def set_msg_first_and_last_transfer(value: str) -> None: ...

msg_first_and_last_transfer = property(get_msg_first_and_last_transfer, set_msg_first_and_last_transfer)

Default Value

""

Remarks

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

msg_message_impl_controlling_agency property

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

Syntax

def get_msg_message_impl_controlling_agency() -> str: ...
def set_msg_message_impl_controlling_agency(value: str) -> None: ...

msg_message_impl_controlling_agency = property(get_msg_message_impl_controlling_agency, set_msg_message_impl_controlling_agency)

Default Value

""

Remarks

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.

msg_message_impl_identification property

Identifies the message implementation.

Syntax

def get_msg_message_impl_identification() -> str: ...
def set_msg_message_impl_identification(value: str) -> None: ...

msg_message_impl_identification = property(get_msg_message_impl_identification, set_msg_message_impl_identification)

Default Value

""

Remarks

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.

msg_message_impl_release property

Identifies the release number for the message implementation.

Syntax

def get_msg_message_impl_release() -> str: ...
def set_msg_message_impl_release(value: str) -> None: ...

msg_message_impl_release = property(get_msg_message_impl_release, set_msg_message_impl_release)

Default Value

""

Remarks

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.

msg_message_impl_version property

Identifies the version number for the message implementation.

Syntax

def get_msg_message_impl_version() -> str: ...
def set_msg_message_impl_version(value: str) -> None: ...

msg_message_impl_version = property(get_msg_message_impl_version, set_msg_message_impl_version)

Default Value

""

Remarks

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.

msg_message_release property

Identifies the release number for the message.

Syntax

def get_msg_message_release() -> str: ...
def set_msg_message_release(value: str) -> None: ...

msg_message_release = property(get_msg_message_release, set_msg_message_release)

Default Value

""

Remarks

Identifies the release number for the message.

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

msg_message_subset_controlling_agency property

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

Syntax

def get_msg_message_subset_controlling_agency() -> str: ...
def set_msg_message_subset_controlling_agency(value: str) -> None: ...

msg_message_subset_controlling_agency = property(get_msg_message_subset_controlling_agency, set_msg_message_subset_controlling_agency)

Default Value

""

Remarks

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.

msg_message_subset_identification property

Identifies the message subset.

Syntax

def get_msg_message_subset_identification() -> str: ...
def set_msg_message_subset_identification(value: str) -> None: ...

msg_message_subset_identification = property(get_msg_message_subset_identification, set_msg_message_subset_identification)

Default Value

""

Remarks

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.

msg_message_subset_release property

Identifies the release number for the message subset.

Syntax

def get_msg_message_subset_release() -> str: ...
def set_msg_message_subset_release(value: str) -> None: ...

msg_message_subset_release = property(get_msg_message_subset_release, set_msg_message_subset_release)

Default Value

""

Remarks

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.

msg_message_subset_version property

Identifies the version number for the message subset.

Syntax

def get_msg_message_subset_version() -> str: ...
def set_msg_message_subset_version(value: str) -> None: ...

msg_message_subset_version = property(get_msg_message_subset_version, set_msg_message_subset_version)

Default Value

""

Remarks

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.

msg_message_type property

A code identifying the message's type.

Syntax

def get_msg_message_type() -> str: ...
def set_msg_message_type(value: str) -> None: ...

msg_message_type = property(get_msg_message_type, set_msg_message_type)

Default Value

""

Remarks

A code identifying the message's type.

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

msg_message_type_sub_function_identification property

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

Syntax

def get_msg_message_type_sub_function_identification() -> str: ...
def set_msg_message_type_sub_function_identification(value: str) -> None: ...

msg_message_type_sub_function_identification = property(get_msg_message_type_sub_function_identification, set_msg_message_type_sub_function_identification)

Default Value

""

Remarks

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.

msg_message_version property

Identifies the version number for the message.

Syntax

def get_msg_message_version() -> str: ...
def set_msg_message_version(value: str) -> None: ...

msg_message_version = property(get_msg_message_version, set_msg_message_version)

Default Value

""

Remarks

Identifies the version number for the message.

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

msg_reference_number property

A unique reference number for the message.

Syntax

def get_msg_reference_number() -> str: ...
def set_msg_reference_number(value: str) -> None: ...

msg_reference_number = property(get_msg_reference_number, set_msg_reference_number)

Default Value

""

Remarks

A unique reference number for the message.

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

msg_scenario_controlling_agency property

Identifies the controlling agency for the message scenario.

Syntax

def get_msg_scenario_controlling_agency() -> str: ...
def set_msg_scenario_controlling_agency(value: str) -> None: ...

msg_scenario_controlling_agency = property(get_msg_scenario_controlling_agency, set_msg_scenario_controlling_agency)

Default Value

""

Remarks

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.

msg_scenario_identification property

The identifier for the message scenario.

Syntax

def get_msg_scenario_identification() -> str: ...
def set_msg_scenario_identification(value: str) -> None: ...

msg_scenario_identification = property(get_msg_scenario_identification, set_msg_scenario_identification)

Default Value

""

Remarks

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.

msg_scenario_release property

The message scenario's release number.

Syntax

def get_msg_scenario_release() -> str: ...
def set_msg_scenario_release(value: str) -> None: ...

msg_scenario_release = property(get_msg_scenario_release, set_msg_scenario_release)

Default Value

""

Remarks

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.

msg_scenario_version property

The message scenario's version number.

Syntax

def get_msg_scenario_version() -> str: ...
def set_msg_scenario_version(value: str) -> None: ...

msg_scenario_version = property(get_msg_scenario_version, set_msg_scenario_version)

Default Value

""

Remarks

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.

msg_sequence_of_transfers property

Specifies the message's position in a sequence.

Syntax

def get_msg_sequence_of_transfers() -> str: ...
def set_msg_sequence_of_transfers(value: str) -> None: ...

msg_sequence_of_transfers = property(get_msg_sequence_of_transfers, set_msg_sequence_of_transfers)

Default Value

""

Remarks

Specifies the message's position in a sequence.

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

message_count property

The number of message in the current Interchange or FunctionalGroup.

Syntax

def get_message_count() -> int: ...

message_count = property(get_message_count, None)

Default Value

0

Remarks

This property contains the number of messages in the current interchange or functional_group.

This property is read-only.

message_index property

The index of the current Message.

Syntax

def get_message_index() -> int: ...
def set_message_index(value: int) -> None: ...

message_index = property(get_message_index, set_message_index)

Default Value

1

Remarks

This property is used to specify a message within the current interchange or functional_group.

Note: When build_dom 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 interchange_index, functional_group_index and MessageIndex to navigate to a specific message within the parsed document.

segment_optional property

Specifies whether the segment is required or optional.

Syntax

def get_segment_optional() -> bool: ...

segment_optional = property(get_segment_optional, None)

Default Value

FALSE

Remarks

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

This property is read-only.

segment_path property

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

Syntax

def get_segment_path() -> str: ...

segment_path = property(get_segment_path, None)

Default Value

""

Remarks

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

This property is read-only.

segment_schema_path property

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

Syntax

def get_segment_schema_path() -> str: ...

segment_schema_path = property(get_segment_schema_path, None)

Default Value

""

Remarks

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

This property is read-only.

segment_tag property

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

Syntax

def get_segment_tag() -> str: ...

segment_tag = property(get_segment_tag, None)

Default Value

""

Remarks

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

This property is read-only.

segment_count property

The number of segments in the current Message.

Syntax

def get_segment_count() -> int: ...

segment_count = property(get_segment_count, None)

Default Value

0

Remarks

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

This property is read-only.

segment_index property

The index of the current segment.

Syntax

def get_segment_index() -> int: ...
def set_segment_index(value: int) -> None: ...

segment_index = property(get_segment_index, set_segment_index)

Default Value

1

Remarks

This property is used to specify a segment within the current message.

Note: When build_dom is set to bdentiredoc, after parse is called the entire EDI document is parsed and stored in memory. You can then use interchange_index, functional_group_index, message_index and SegmentIndex to navigate to specific segment within the parsed document.

validate_on_parse property

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

Syntax

def get_validate_on_parse() -> bool: ...
def set_validate_on_parse(value: bool) -> None: ...

validate_on_parse = property(get_validate_on_parse, set_validate_on_parse)

Default Value

FALSE

Remarks

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

config method

Sets or retrieves a configuration setting.

Syntax

def config(configuration_string: str) -> str: ...

Remarks

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

These settings are similar in functionality to properties, but they are rarely used. In order to avoid "polluting" the property namespace of the class, 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.

generate_ack method

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

Syntax

def generate_ack() -> str: ...

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 ack_type property.

get_element_value method

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

Syntax

def get_element_value(path: str) -> str: ...

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");

load_schema method

Loads schema information from a file or string data.

Syntax

def load_schema(file_or_data: str, message_name: str) -> None: ...

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

Parse the EDI document and fire parsing events.

Syntax

def parse() -> None: ...

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. set_input_stream
  2. input_file
  3. input_data

reset method

Resets all properties to their default values.

Syntax

def reset() -> None: ...

Remarks

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

schema_code method

Defines a code value within a list of codes.

Syntax

def schema_code(schema_id: str, code_list_id: str, value: str, description: str) -> None: ...

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.

schema_code_list method

Defines a list of codes.

Syntax

def schema_code_list(schema_id: str, code_list_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for an empty list of codes. schema_code 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.

schema_composite method

Defines a composite element.

Syntax

def schema_composite(schema_id: str, composite_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for a composite element. schema_element_ref 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.

schema_element method

Defines a simple element.

Syntax

def schema_element(schema_id: str, element_id: str, data_type: str, min_length: int, max_length: int, code_id: str, description: str) -> None: ...

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.

schema_element_ref method

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

Syntax

def schema_element_ref(schema_id: str, parent_id: str, element_id: str, ref_id: str, required: bool, max_count: int) -> None: ...

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.

schema_end method

Ends a schema definition.

Syntax

def schema_end() -> None: ...

Remarks

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

schema_group method

Defines a group of segments.

Syntax

def schema_group(schema_id: str, group_path: str, group_id: str, required: bool, max_count: int) -> None: ...

Remarks

Creates a schema definition for a group of segments. schema_segment_ref 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.

schema_message method

Defines a message.

Syntax

def schema_message(schema_id: str, message_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for a message. schema_segment_ref and schema_group 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.

schema_segment method

Defines a segment.

Syntax

def schema_segment(schema_id: str, segment_id: str, description: str) -> None: ...

Remarks

Creates a schema definition for a segment. schema_element_ref 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.

schema_segment_ref method

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

Syntax

def schema_segment_ref(schema_id: str, segment_path: str, segment_id: str, required: bool, max_count: int) -> None: ...

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.

schema_start method

Starts a schema definition.

Syntax

def schema_start(schema_id: str) -> None: ...

Remarks

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

validate method

Validate the EDI document and warn about any errors encountered.

Syntax

def validate() -> None: ...

Remarks

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

on_end_functional_group event

Fires at the end of a functional group while parsing.

Syntax

class EDIFACTReaderEndFunctionalGroupEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def message_count() -> int: ...

  @property
  def reference_number() -> str: ...

# In class EDIFACTReader:
@property
def on_end_functional_group() -> Callable[[EDIFACTReaderEndFunctionalGroupEventParams], None]: ...
@on_end_functional_group.setter
def on_end_functional_group(event_hook: Callable[[EDIFACTReaderEndFunctionalGroupEventParams], None]) -> None: ...

Remarks

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

on_end_group event

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

Syntax

class EDIFACTReaderEndGroupEventParams(object):
  @property
  def name() -> str: ...

  @property
  def schema_index() -> int: ...

# In class EDIFACTReader:
@property
def on_end_group() -> Callable[[EDIFACTReaderEndGroupEventParams], None]: ...
@on_end_group.setter
def on_end_group(event_hook: Callable[[EDIFACTReaderEndGroupEventParams], None]) -> None: ...

Remarks

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

on_end_interchange event

Fires at the end of an interchange while parsing.

Syntax

class EDIFACTReaderEndInterchangeEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def group_count() -> int: ...

  @property
  def reference_number() -> str: ...

# In class EDIFACTReader:
@property
def on_end_interchange() -> Callable[[EDIFACTReaderEndInterchangeEventParams], None]: ...
@on_end_interchange.setter
def on_end_interchange(event_hook: Callable[[EDIFACTReaderEndInterchangeEventParams], None]) -> None: ...

Remarks

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

on_end_message event

Fires at the end of a message while parsing.

Syntax

class EDIFACTReaderEndMessageEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def segment_count() -> int: ...

  @property
  def reference_number() -> str: ...

# In class EDIFACTReader:
@property
def on_end_message() -> Callable[[EDIFACTReaderEndMessageEventParams], None]: ...
@on_end_message.setter
def on_end_message(event_hook: Callable[[EDIFACTReaderEndMessageEventParams], None]) -> None: ...

Remarks

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

on_error event

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

Syntax

class EDIFACTReaderErrorEventParams(object):
  @property
  def error_code() -> int: ...

  @property
  def description() -> str: ...

# In class EDIFACTReader:
@property
def on_error() -> Callable[[EDIFACTReaderErrorEventParams], None]: ...
@on_error.setter
def on_error(event_hook: Callable[[EDIFACTReaderErrorEventParams], None]) -> None: ...

Remarks

The on_error event is fired in case of exceptional conditions during message processing. Normally, the class fails with an error.

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.

on_resolve_schema event

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

Syntax

class EDIFACTReaderResolveSchemaEventParams(object):
  @property
  def message_version() -> str: ...

  @property
  def message_type() -> str: ...

# In class EDIFACTReader:
@property
def on_resolve_schema() -> Callable[[EDIFACTReaderResolveSchemaEventParams], None]: ...
@on_resolve_schema.setter
def on_resolve_schema(event_hook: Callable[[EDIFACTReaderResolveSchemaEventParams], None]) -> None: ...

Remarks

This method fires when the class 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 load_schema.

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

MessageType - The type of message, such as INVOIC.

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

on_segment event

Fires at the end of a Segment while parsing.

Syntax

class EDIFACTReaderSegmentEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def schema_path() -> str: ...

  @property
  def optional() -> bool: ...

  @property
  def element_count() -> int: ...

  @property
  def schema_index() -> int: ...

  @property
  def segment_index() -> int: ...

  @property
  def max_count() -> int: ...

  @property
  def path() -> str: ...

# In class EDIFACTReader:
@property
def on_segment() -> Callable[[EDIFACTReaderSegmentEventParams], None]: ...
@on_segment.setter
def on_segment(event_hook: Callable[[EDIFACTReaderSegmentEventParams], None]) -> None: ...

Remarks

Fires at the end of a segment while parsing a document

on_start_functional_group event

Fires at the beginning of a functional group while parsing.

Syntax

class EDIFACTReaderStartFunctionalGroupEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def app_sender_identification() -> str: ...

  @property
  def app_recipient_identification() -> str: ...

  @property
  def date_time() -> str: ...

  @property
  def reference_number() -> str: ...

# In class EDIFACTReader:
@property
def on_start_functional_group() -> Callable[[EDIFACTReaderStartFunctionalGroupEventParams], None]: ...
@on_start_functional_group.setter
def on_start_functional_group(event_hook: Callable[[EDIFACTReaderStartFunctionalGroupEventParams], None]) -> None: ...

Remarks

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

on_start_group event

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

Syntax

class EDIFACTReaderStartGroupEventParams(object):
  @property
  def name() -> str: ...

  @property
  def schema_index() -> int: ...

  @property
  def max_count() -> int: ...

  @property
  def path() -> str: ...

# In class EDIFACTReader:
@property
def on_start_group() -> Callable[[EDIFACTReaderStartGroupEventParams], None]: ...
@on_start_group.setter
def on_start_group(event_hook: Callable[[EDIFACTReaderStartGroupEventParams], None]) -> None: ...

Remarks

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

on_start_interchange event

Fires at the beginning of an interchange while parsing.

Syntax

class EDIFACTReaderStartInterchangeEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def syntax_identifier() -> str: ...

  @property
  def syntax_version() -> str: ...

  @property
  def sender_identification() -> str: ...

  @property
  def recipient_identification() -> str: ...

  @property
  def date_time() -> str: ...

  @property
  def reference_number() -> str: ...

# In class EDIFACTReader:
@property
def on_start_interchange() -> Callable[[EDIFACTReaderStartInterchangeEventParams], None]: ...
@on_start_interchange.setter
def on_start_interchange(event_hook: Callable[[EDIFACTReaderStartInterchangeEventParams], None]) -> None: ...

Remarks

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

on_start_message event

Fires at the beginning of a message while parsing.

Syntax

class EDIFACTReaderStartMessageEventParams(object):
  @property
  def tag() -> str: ...

  @property
  def message_release() -> str: ...

  @property
  def message_type() -> str: ...

  @property
  def reference_number() -> str: ...

  @property
  def schema_loaded() -> bool: ...

# In class EDIFACTReader:
@property
def on_start_message() -> Callable[[EDIFACTReaderStartMessageEventParams], None]: ...
@on_start_message.setter
def on_start_message(event_hook: Callable[[EDIFACTReaderStartMessageEventParams], None]) -> None: ...

Remarks

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

on_validate_warning event

Fires to warn about validation errors.

Syntax

class EDIFACTReaderValidateWarningEventParams(object):
  @property
  def position() -> int: ...

  @property
  def line() -> int: ...

  @property
  def column() -> int: ...

  @property
  def error_code() -> str: ...

  @property
  def error_message() -> str: ...

  @property
  def error_type() -> int: ...

# In class EDIFACTReader:
@property
def on_validate_warning() -> Callable[[EDIFACTReaderValidateWarningEventParams], None]: ...
@on_validate_warning.setter
def on_validate_warning(event_hook: Callable[[EDIFACTReaderValidateWarningEventParams], None]) -> None: ...

Remarks

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

EDIFACTReader Config Settings

The class 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 class, 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.

EDIFACTReader Errors

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.