Reads the next item of the input file or input string.
[Visual Basic] Function ReadItem() As Integer [C#] int ReadItem(); [C++] int ReadItem(); [JScript] function ReadItem(): int;
The type of the item processed. The value is one of the FilterItemType values.
Use this method to read the next ietm in the current input. You must call OpenInputFile, OpenInputString, or ResetInput prior call this method a first time.
After this method has been called, you can use the GetItem method to access the different data that have been parsed from the input. The data available depend on the type of item returned (see FilterItemType for details).
The following example shows how to traverse an input file using the Filter interface:
myLog.BeginProcess("Test extraction"); myFilter.OpenInputFile("myFile.xyz", "en-us", "windows-1252"); int nRes; do { nRes = myFilter.ReadItem(); switch ( nRes ) { case FiterItemType.ERROR: myLog.Error("An error has occurred."); continue; case FiterItemType.USERCANCEL: myLog.Message("Operation cancelled."); continue; case FiterItemType.ENDINPUT: continue; // Normal end case FilterItemType.TEXT: case FilterItemType.STARTGROUP: case FilterItemType.ENDGROUP: case FilterItemType.BINARY: // Do something with the item ... break; } } while ( nRes > FiterItemType.ENDINPUT ); myFilter.CloseInput(); myLog.EndProcess(null);
IFilter Interface | Okapi.Library.Filter Namespace | OpenInputFile | OpenInputString | ResetInput | GetItem