Show / Hide Table of Contents

Class XmlDocumentProvider

An implementation of IReadsAndWritesDocument which uses the XML/Linq API built-into .NET Framework and dotnet core. See also: System.Xml.Linq.XDocument

Inheritance
System.Object
DocumentReaderWriterBase<XmlDocument>
XmlDocumentProvider
Implements
IReadsAndWritesDocument
Inherited Members
DocumentReaderWriterBase<XmlDocument>.GetDocumentAsync(Stream, RenderingConfig, IDocumentSourceInfo, CancellationToken)
DocumentReaderWriterBase<XmlDocument>.WriteDocumentAsync(IDocument, RenderingConfig, CancellationToken)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: ZptSharp.Dom
Assembly: ZptSharp.Xml.dll
Syntax
public class XmlDocumentProvider : DocumentReaderWriterBase<XmlDocument>, IReadsAndWritesDocument

Constructors

| Improve this Doc View Source

XmlDocumentProvider(IGetsXmlReaderSettings)

Initializes a new instance of the XmlDocumentProvider class.

Declaration
public XmlDocumentProvider(IGetsXmlReaderSettings readerSettingsProvider)
Parameters
Type Name Description
IGetsXmlReaderSettings readerSettingsProvider

Reader settings provider.

Properties

| Improve this Doc View Source

ResolvableType

Gets the type of the current instance, for the purpose of future dependency resolution.

Declaration
public override Type ResolvableType { get; }
Property Value
Type Description
System.Type
Overrides
ZptSharp.Dom.DocumentReaderWriterBase<ZptSharp.Dom.XmlDocument>.ResolvableType
Remarks

Gets the type of the current instance, for the purpose of dependency resolution. This is not/should not be quite the same as System.Object.GetType(), because a derived implementation might not always be resolved as its precise type, it might be resolved as a less-derived base type.

Methods

| Improve this Doc View Source

CanReadWriteForFilename(String)

Gets whether or not the current instance may be used to read & write documents which have the specified filename.

Declaration
public override bool CanReadWriteForFilename(string filenameOrPath)
Parameters
Type Name Description
System.String filenameOrPath

The filename of a ZPT document.

Returns
Type Description
System.Boolean

true, if this instance maybe used, false otherwise.

Overrides
ZptSharp.Dom.DocumentReaderWriterBase<ZptSharp.Dom.XmlDocument>.CanReadWriteForFilename(System.String)
| Improve this Doc View Source

GetDocumentProtectedAsync(Stream, RenderingConfig, IDocumentSourceInfo, CancellationToken)

Implement this method in a derived class to perform custom logic related to reading a document from a stream. Derived types should assume that the stream & config parameters have been null-checked. Also, they should assume that the token parameter does not request cancellation.

Declaration
protected override Task<IDocument> GetDocumentProtectedAsync(Stream stream, RenderingConfig config, IDocumentSourceInfo sourceInfo, CancellationToken token)
Parameters
Type Name Description
System.IO.Stream stream

A stream containing the source of the document.

RenderingConfig config

Rendering configuration.

IDocumentSourceInfo sourceInfo

Information which identifies the source of the document.

System.Threading.CancellationToken token

An object used to cancel the operation if required.

Returns
Type Description
System.Threading.Tasks.Task<IDocument>

A task which provides the document which has been read.

Overrides
ZptSharp.Dom.DocumentReaderWriterBase<ZptSharp.Dom.XmlDocument>.GetDocumentProtectedAsync(System.IO.Stream, ZptSharp.Config.RenderingConfig, ZptSharp.Rendering.IDocumentSourceInfo, System.Threading.CancellationToken)
Remarks

This implementation is not truly asynchronous, as the APIs involved do not provide async functionality.

| Improve this Doc View Source

WriteDocumentProtectedAsync(XmlDocument, RenderingConfig, CancellationToken)

Implement this method in a derived class to perform custom logic related to writing a document to a stream. Derived types should assume that the document & config parameters have been null-checked. The document will also already be converted to XmlDocument. Finally, the token parameter will have already been checked that it does not request cancellation.

Declaration
protected override Task<Stream> WriteDocumentProtectedAsync(XmlDocument document, RenderingConfig config, CancellationToken token)
Parameters
Type Name Description
XmlDocument document

The document to write.

RenderingConfig config

Rendering configuration.

System.Threading.CancellationToken token

An object used to cancel the operation if required.

Returns
Type Description
System.Threading.Tasks.Task<System.IO.Stream>

A task which provides the output stream.

Overrides
ZptSharp.Dom.DocumentReaderWriterBase<ZptSharp.Dom.XmlDocument>.WriteDocumentProtectedAsync(ZptSharp.Dom.XmlDocument, ZptSharp.Config.RenderingConfig, System.Threading.CancellationToken)

Implements

IReadsAndWritesDocument
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX