C# Class Mvp.Xml.Common.XPath.XPathDocumentWriter

XmlWriter that can produce an XPathDocument without the need to parse XML.
Using this writer whenever you need to perform fast chained transformations. Using this class avoids reparsing of the intermediate output, yielding lower memory and CPU usage.

Future versions of XPathDocument may offer this functionality out of the box.

Important: this class requires unrestricted member access reflection permissions in order to run. If the Mvp.Xml assembly is installed in the GAC, it will run without problems. The Mvp.Xml allows partially trusted callers, so only this assembly needs to be GAC'ed.

Alternatively, you can configure .NET security policy to allow the appropriate permission (see ReflectionPermission, PermissionState.Unrestricted and ReflectionPermissionFlag.MemberAccess).

Inheritance: System.Xml.XmlWrappingWriter
Mostrar archivo Open project: Monobjc/monobjc-tools Class Usage Examples

Public Methods

Method Description
Close ( ) : XPathDocument

Closes the writer and retrieves the created XPathDocument.

WriteStartElement ( string prefix, string localName, string ns ) : void

See XmlWriter.WriteStartElement(string, string, string).

XPathDocumentWriter ( string baseUri ) : System

Initializes a new instance of XPathDocumentWriter using the given baseUri.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Never disposes the underlying writer as it's not keeping in-memory state.

This override also avoids an exception that is thrown otherwise by the base System.Xml.XmlRawWriter being used internally.

Private Methods

Method Description
CreateDocument ( ) : XPathDocument
GetWriter ( XPathDocument document, string baseUri ) : XmlWriter
XPathDocumentWriter ( ) : System

Method Details

Close() public method

Closes the writer and retrieves the created XPathDocument.
public Close ( ) : XPathDocument
return System.Xml.XPath.XPathDocument

Dispose() protected method

Never disposes the underlying writer as it's not keeping in-memory state.
This override also avoids an exception that is thrown otherwise by the base System.Xml.XmlRawWriter being used internally.
protected Dispose ( bool disposing ) : void
disposing bool
return void

WriteStartElement() public method

See XmlWriter.WriteStartElement(string, string, string).
public WriteStartElement ( string prefix, string localName, string ns ) : void
prefix string
localName string
ns string
return void

XPathDocumentWriter() public method

Initializes a new instance of XPathDocumentWriter using the given baseUri.
public XPathDocumentWriter ( string baseUri ) : System
baseUri string Base URI to used to construct the .
return System