Class X12Parser
- Namespace
- EDIParser
- Assembly
- EDIParser.dll
Parses ANSI X12 messages using the delimiters and structural rules defined by the X12 standard.
public sealed class X12Parser : Parser, IComponent, IDisposable
- Inheritance
-
X12Parser
- Implements
- Inherited Members
Remarks
The parser is initialized with the default X12 separators:
segment ~, field *, component >, and repetition
^.
When CheckISASeparator is enabled, the parser reads separator values from the ISA segment before parsing the remainder of the message.
Constructors
X12Parser()
Initializes a new instance of the X12Parser class using the default X12 delimiters.
public X12Parser()
Properties
CheckISASeparator
Gets or sets a value indicating whether separator characters should be read from the ISA segment before parsing.
public bool CheckISASeparator { get; set; }
Property Value
- bool
true to detect separators from the ISA segment; otherwise, false to use the currently configured separators.
TransactionFunctionalGroupCount
Gets the number of transaction sets counted in the current functional group.
public int TransactionFunctionalGroupCount { get; }
Property Value
TransactionInterchangeCount
Gets the number of functional groups counted in the current interchange.
public int TransactionInterchangeCount { get; }
Property Value
TransactionSegmentCount
Gets the number of segments counted in the current X12 transaction set.
public int TransactionSegmentCount { get; }
Property Value
Remarks
The count is updated when segments are added through the parser's value indexer.
Methods
ParseMsg(string)
Parses an ANSI X12 message and populates the parser object model.
public override void ParseMsg(string msg)
Parameters
msgstringThe X12 message to parse.
Remarks
When CheckISASeparator is enabled and the message begins with an ISA segment, the segment, field, and component separators are derived from their fixed ISA positions.
Carriage-return and line-feed characters that are not configured as the segment separator are removed before the message is passed to the base parser.
Exceptions
- ArgumentException
Thrown when
msgis null or empty.