Parse Method

Parse the specified input data.

Syntax

ANSI (Cross Platform)
int Parse();

Unicode (Windows)
INT Parse();
- (void)parse;
#define MID_X12READER_PARSE 11

IPWORKSX12_EXTERNAL int IPWORKSX12_CALL IPWorksX12_X12Reader_Do(void *lpObj, int methid, int cparam, void *param[], int cbparam[], int64 *lpllVal);

Remarks

This method parsed the input data specified by 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.

Error Handling (C++)

This method returns a result code; 0 indicates success, while a non-zero error code indicates that this method encountered an error during its execution. If an error occurs, the GetLastError() method can be called to retrieve the associated error message. (Note: This method's result code can also be obtained by calling the GetLastErrorCode() method after it returns.)

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