In each <Message>.config file, the structure of a Message element is determined by the XML schema of the EDI standard that you are customizing. This schema is called EDIConfig.xsd (or a similar name, see EDI Configuration Schemas). To build or change the structure of the message, you will therefore need to consult both the documentation of your custom EDI standard and the XML schema.
How to add segments, data elements, and composites
To add data elements, segments, composites, and subcomposites, create <Data>, <Segment>, <Composite>, and <SubComposite> elements as follows:
•The .segment file must contain the list of all reusable, globally-defined segments and data elements.
•The .config file corresponding to each message (or transaction) type must contain the actual structure of that message (the hierarchy of segments, composites, and data elements).
This makes it possible to define a data element once (in the .segment file) and reuse it in multiple messages (in .config files).
To refer to a data element, use the ref attribute. For example, the code listing below shows how data element F100 is defined in the X12.Segment file of the HIPAA.X12 collection.
<Data name="F100" type="string" maxLength="3" minLength="3" info="Currency Code" />
All segments, in all transaction types that need this data element, can now refer to it. The code listing below shows how the "CUR" segment of the "Health Care: Professional" (837P) transaction refers to the F100 data element previously defined:
<Include href="X12.Segment" />
<Segment name="CUR" minOccurs="0" info="Foreign Currency Information">
837P.Config file (X12)
A reference can be in the same file, or in an external file. In the code listing above, the .config file includes a reference to an external .segment file. For this reason, an <Include href="X12.Segment" /> statement is present at the beginning of the 837P.Config file to add the reference to the external X12.Segment file.
For another example that shows how to add a custom segment, see Example: Adding the TA1 Segment.
How to create groups and loops
Creating or changing EDI structures often requires grouping of segments or data elements under some parent node (a group). Even the message on the EDI component is a group, since it groups together all the multiple segments that this message consists of. Groups may be nested (they can have child groups). Also, they may be repeated multiple times (in which case, they become loops). Groups and loops can be created by adding a <Group> element. Use the maxOccurs attribute to set the number of allowed occurrences of a loop. For example, the following code listing shows a loop that can occur up to 25 times, is optional, and consists of two segments:
<Group name="LoopSAC" maxOccurs="25" minOccurs="0">
850.Config file (X12)
How to specify the type and size of data elements
Use the type attribute of a data element or segment to specify its type (string, decimal, etc.). The possible data types (the type attribute) are generally any of XML Schema types that are used in the configuration files delivered by default. Other XML Schema simple types can tentatively be used, but cannot be guaranteed. The following simple types are not supported: "anyType", "ENTITIES" and "QName".
Use the minLength and maxLength attributes of a data element to specify its minimum and maximum length.
How to specify mandatory and optional data elements
To specify that a data element is mandatory, do not set the value of the minOccurs attribute (this attribute has "1" as default value, which means the field is mandatory by default). To specify that a data element is optional, set the minOccurs attribute to "0". For example, the code listing below defines two mandatory data elements (F1331, F1332) and one optional data element (F1325).
<Composite name="C023" info="Health Care Service Location Information">