Text Top-Level classes
TextDOM API provides a set of top-level classes. These classes will help you to load, parse and validate text documents and schemas.Class TextSchemaParser
public class TextSchemaParser : ITextSchemaReader
This is a schema parser for schemas written in Text Data Description Language (TDDL).
It is possible to provide alternate data description language and implement an alternative schema parser class. Alternate parser must implement IBinSchemaReader interface.
Constructor | Parameters | Description |
TextSchemaParser | None | Default constructor. |
Property | Type | Description |
Greedy | bool, get/set | It is possible to set greedy enumeration parsing option programmatically, except of header property. |
Method | Parameters | Description |
AddIncludeFolder | string path, returns void | Add a path to the list of include folders. When the parser processes include instruction, it uses the following order:
|
Parse | TextReader textreader, TextSchema schema, TextValidationEventHandler handler, returns void | Implementation of ITextSchemaReader interface. Parses a file from TextReader, fills TextSchema with parsed schema objects and calls back handler on errors. |
Class TextDataReader
public class TextDataReader
This class parses text data and converts it into TextDOM data structures according to metainformation (text document schema).
Constructor | Parameters | Description |
TextDataReader | None | Default constructor. |
Property | Type | Description |
DebugHandler | TextDebugHandler, get/set | Set debug handler callback (before parsing). |
Method | Parameters | Description |
Parse | TextDocument doc, TextReader stream, TextEventHandler handler, returns bool | Parses a text data from TextReader, fills TextDocument objects and uses calls back handler on errors. TextDocument must be empty and must have a valid reference to a document schema (Schema property must be set). Returns true on success. |
ParseRule | TextRule node, TextReader stream, TextEventHandler handler, returns bool | Parses text data from TextReader, fills TextRule as a separate structure and calls back handler on errors. TextRule must be empty and must have a valid reference to SchemaInfo with valid metainformation (SchemaType). Returns true on success. |
Class TextValidator
public class TextValidator
This class validates "manually built" TextDOM data structures against metainformation (text document schema).
Constructor | Parameters | Description |
TextValidator | TextSchema schema | Initializes an object with schema reference. |
Property | Type | Description |
Method | Parameters | Description |
Validate | TextDocument doc, TextEventHandler handler, returns bool | Validates document against schema and calls back handler on errors. Returns true on success. |
ValidateRule | TextRule node, TextEventHandler handler, returns bool | Validates filled rule and calls back handler on errors. TextRule must have a valid reference to SchemaInfo with valid metainformation (SchemaType). Returns true on success. |
ValidateRule | TextRule node, string name, TextEventHandler handler, returns bool | Validates a filled rule as a rule refered by "name" in schema and calls back handler on errors. Returns true on success. |
Class TextSchemaSet
public class TextSchemaSet : List<TextSchema>
This class is designed to load and validate standard text schema set. If you do not know up-front which data type you are going to use, or if you need to work with multiple data types, use this class in your application. This class loads documents and validate them against the loaded schemas.
This class is derived from a list of TextSchema, i.e. loaded schemas could be accessed as list elements.
Constructor | Parameters | Description |
TextSchemaSet | None | Default constructor. |
Property | Type | Description |
SchemaErrors | List<TextSchemaValidationEntry>, get only | Get list of schemas validation errors, grouped by schema files. Each entry represents an errors set for a single file. |
DocumentErrors | List<TextDocumentValidationEntry>, get only | Get list of documents loading errors, grouped by document filed. Each entry represents an errors set for a single file. |
Method | Parameters | Description |
LoadSchemas | returns int | Loads all schemas into TextSchemaSet internal collection from %Common_Appdata%/Miraplacid/BinaryDOM/TextSchemas folder. If some schema is invalid, it will not be included into the collection. Returns number of schemas loaded. |
LoadSchema | string filename, returns bool | Loads specific schema. If specified schema is invalid, it will not be included into the collection. Returns true if schema was loaded successfully. |
LoadDocument | string filename, bool use_ext, returns TextDocument | Tries to load a document from a file specified by filename. If use_ext parameter is true, method will try to load the document with schemas with file extension in their extensions list. If this parameter is false, method will try to load the document with each schema loaded into TextSchemaSet. If document load failed, LoadDocument keeps trying to load it with the next applicable schema. |
LoadDocumentAs | string filename, string mime, returns TextDocument | Tries to load the document from a file specified by filename. In this method, mime must not be null or empty. File extension will not be taken into consideration. If provided mime type corresponds to mime_type provied in document schema, this method tries to load the document with the schema information. If document load failed, LoadDocumentAs will not try to load it with any other schema. |
ClearErrors | returns void | Clear all errors and returns TextSchemaSet object to initial state. |
Class TextSchemaValidationEntry
public class TextSchemaValidationEntry : List<TextValidationEventArgs>
Represents collection of errors related to a specific schema file.
This class is derived from a list of TextValidationEventArgs, i.e. TextValidationEventArgs could be accessed as list elements.
Constructor | Parameters | Description |
TextSchemaValidationEntry | string filename | Initializes TextSchemaValidationEntry object for the specified file. |
Property | Type | Description |
File | string, get only | Returns file name. |
Class TextDocumentValidationEntry
public class TextDocumentValidationEntry : List<TextEventArgs>
Represents collection of errors related to a specific document.
This class is derived from a list of TextEventArgs, i.e. TextEventArgs could be accessed as list elements.
Constructor | Parameters | Description |
TextDocumentValidationEntry | TextSchemaDocument bdoc | Initializes TextDocumentValidationEntry object for the specified schema document. |
Property | Type | Description |
Document | TextSchemaDocument, get only | Returns schema document. |
Class TextDocumentEnumerator
public class TextDocumentEnumerator : IEnumerable<TextNode>
Represents collection of all nodes in document to help use document in Lynq queries.
Constructor | Parameters | Description |
TextDocumentEnumerator | TextDocument doc | Initializes collection of nodes. Nodes will be enumerated in order of document tree traversal. |
See also:
- About Miraplacid Binary and Text DOM Library
- Binary Data Definition Language
- BinPath Expression Language
- Text Data Definition Language
- BinaryDOM and TextDOM API
- Binary Schema Object Model (BinSOM) classes
- Binary Document Object Model (BinDOM) classes
- BinPath classes
- Binary Top-Level classes
- Text Schema Object Model (TextSOM) classes
- Text Document Object Model (TextDOM) classes
- Text Navigation classes
- Text Top-Level classes
- BinaryDOM / TextDOM Common classes
- Low-Level classes
- Extension Components
- BinaryDOM PowerShell Snapin
- BinaryDOM SDK examples
- TextDOM SDK examples
- Miraplacid Binary DOM SDK Main Page