Parse Method

Parse the specified input data.

Syntax

public void parse();

Remarks

This method parsed the input data specified by SetOutputStream, InputFile or InputData.

During parsing the following events may fire:

After Parse returns the document may be traversed by setting the XPath property. The XPath navigation is done through the XPath property. For example:

EDIReader.XPath = "/IX[1]/FG[1]/TX[2]/N1Loop1[1]/N1[1]";
This example path means the following: Select the first N1 segment within the first iteration of the N1Loop1, within second transaction in the first functional group and interchange.

You can also make use of XPath conditional statements to locate the first element which matches a name=value. For example, you could use the following XPath to locate the path of the first element within any N1Loop1 that has a name=N101 and value=BT:

EDIReader.XPath = "IX[1]/FG[1]/TX[1]/N1Loop1[N101='BT']";

Note that the conditional statements will search the children, but not the grand children of the element on which the conditional statement is applied. For instance in the above example the children of N1Loop1 will be searched, but the grandchildren will not.

Additionally if the schema loaded is a ArcESB JSON schema the element Id (from the schema) can be used in the conditional statement. For instance instead of N101 the following is also acceptable:

EDIReader.XPath = "IX[1]/FG[1]/TX[1]/N1Loop1[98='BT']";

Input Properties

The class will determine the source of the input based on which properties are set.

The order in which the input properties are checked is as follows:

When a valid source is found the search stops.

InputData Notes

When setting data to parse via InputData fragments or complete documents may be specified. To parse data in chunks set InputData and call Parse for each fragment.

When the parser is finally reset via the Reset method, all buffered text is flushed out through the ExtraData property.

Since the class can be used to parse EDI data fragments, the internal buffer will not be cleared until Reset is called. If you plan to use this method to parse multiple complete EDI documents be sure to call Reset between calls.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks X12 2020 Java Edition - Version 20.0 [Build 8155]