Method TryParse
- Namespace
- IntentSharp.Documents
- Assembly
- IntentSharp.dll
TryParse(DocumentId, string, out ParsedDocument?, out DocumentProblem?)
Parses a document's text with the format registered for its extension. When no format is registered for the extension, the text is not valid in the format, or the format fails to read it, returns false with the load problem: the missing format's problem names the extension and the registered formats; the format's problem (a DocumentFormatException) carries its line when known; any other exception the format throws, other than an OperationCanceledException, becomes a problem naming the format and the exception.
public bool TryParse(DocumentId id, string text, out ParsedDocument? document, out DocumentProblem? problem)
Parameters
idDocumentIdThe document, whose extension chooses the format.
textstringThe document's text.
documentParsedDocumentThe parsed document; null when parsing failed.
problemDocumentProblemThe load problem; null when parsing succeeded.
Returns
- bool
True when the text parsed.
Exceptions
- ArgumentNullException
textis null.- ArgumentException
A default DocumentId, which names no document.
- OperationCanceledException
The format was canceled while it read the document.