IDocument Interface

Summary

Contains content and metadata for each item as it propagates through the pipeline.
Assembly
Wyam.Common.dll
Namespace
Wyam.Common.Documents
Interfaces
  • IMetadata
  • IReadOnlyDictionary<string, Object>
  • IDisposable
Implementing Types
graph BT Type-.->Interface0["IMetadata"] click Interface0 "/api/Wyam.Common.Meta/IMetadata" Type-.->Interface1["IReadOnlyDictionary<string, Object>"] Type-.->Interface2["IDisposable"] Type["IDocument"] class Type type-node Implementing0["TestDocument"]-.->Type click Implementing0 "/api/Wyam.Testing.Documents/TestDocument" Implementing1["CustomDocument"]-.->Type click Implementing1 "/api/Wyam.Core.Documents/CustomDocument"

Syntax

public interface IDocument : IMetadata, IReadOnlyDictionary<string, Object>, IDisposable

Remarks

Documents are immutable so you must call one of the GetDocument methods of Wyam.Common.Documents.IDocumentFactory to create a new document. Implements Wyam.Common.Meta.IMetadata and all metadata calls are passed through to the document's internal Wyam.Common.Meta.IMetadata instance (exposed via the Wyam.Common.Documents.IDocument.Metadata property). Note that both the Wyam.Common.Documents.IDocument.Content property and the result of the Wyam.Common.Documents.IDocument.GetStream method are guaranteed not to be null. When a document is created, either a string or a System.IO.Stream is provided. Whenever the other of the two is requested, the system will convert the current representation for you.

Properties

Name Value Summary
Content string
Gets the content associated with this document as a string. This will result in reading the entire content stream.
Id string
An identifier that is generated when the document is created and stays the same after cloning.
Metadata IMetadata
Gets the metadata associated with this document.
Source FilePath
An identifier for the document meant to reflect the source of the data. These should be unique (such as a file name).
WithoutSettings IMetadata
Gets the metadata for this document without any global settings included.

Methods

Name Value Summary
GetStream() Stream
Gets the content associated with this document as a System.IO.Stream. The underlying stream will be reset to position 0 each time this method is called. The stream you get from this call must be disposed as soon as reading is complete. Other threads will block on this call until the previously returned stream is disposed.
SourceString() string
Gets a string representation of the source that's guaranteed non-null, used primarily for trace messages.

Extension Methods

Name Value Summary
ParseHtml() IHtmlDocument
Gets an AngleSharp.Html.Dom.IHtmlDocument by parsing the content of an Wyam.Common.Documents.IDocument.
ParseHtml(HtmlParser) IHtmlDocument
Gets an AngleSharp.Html.Dom.IHtmlDocument by parsing the content of an Wyam.Common.Documents.IDocument.
GitHub