C# Class HtmlKit.HtmlWriter

An HTML writer.
An HTML writer.
Inheritance: IDisposable
显示文件 Open project: prepare/HTML-Renderer Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Releases all resource used by the HtmlKit.HtmlWriter object.

Call Dispose() when you are finished using the HtmlKit.HtmlWriter. The Dispose() method leaves the HtmlKit.HtmlWriter in an unusable state. After calling Dispose(), you must release all references to the HtmlKit.HtmlWriter so the garbage collector can reclaim the memory that the HtmlKit.HtmlWriter was occupying.

Flush ( ) : void

Flush any remaining state to the output stream.

Flushes any remaining state to the output stream.

HtmlWriter ( Stream stream, Encoding encoding ) : System

Initializes a new instance of the HtmlKit.HtmlWriter class.

Creates a new HtmlWriter.

HtmlWriter ( TextWriter output ) : System

Initializes a new instance of the HtmlKit.HtmlWriter class.

Creates a new HtmlWriter.

WriteAttribute ( HtmlAttribute attribute ) : void

Write the attribute to the output stream.

Writes the attribute to the output stream.

WriteAttribute ( HtmlAttributeId id, char buffer, int index, int count ) : void

Write the attribute to the output stream.

Writes the attribute to the output stream.

WriteAttribute ( HtmlAttributeId id, string value ) : void

Write the attribute to the output stream.

Writes the attribute to the output stream.

WriteAttribute ( string name, char buffer, int index, int count ) : void

Write the attribute to the output stream.

Writes the attribute to the output stream.

WriteAttribute ( string name, string value ) : void

Write the attribute to the output stream.

Writes the attribute to the output stream.

WriteAttributeName ( HtmlAttributeId id ) : void

Write the attribute name to the output stream.

Writes the attribute name to the output stream.

WriteAttributeName ( string name ) : void

Write the attribute name to the output stream.

Writes the attribute name to the output stream.

WriteAttributeValue ( char buffer, int index, int count ) : void

Write the attribute value to the output stream.

Writes the attribute value to the output stream.

WriteAttributeValue ( string value ) : void

Write the attribute value to the output stream.

Writes the attribute value to the output stream.

WriteEmptyElementTag ( HtmlTagId id ) : void

Write an empty element tag.

Writes an empty element tag.

WriteEmptyElementTag ( string name ) : void

Write an empty element tag.

Writes an empty element tag.

WriteEndTag ( HtmlTagId id ) : void

Write an end tag.

Writes an end tag.

WriteEndTag ( string name ) : void

Write an end tag.

Writes an end tag.

WriteMarkupText ( char buffer, int index, int count ) : void

Write a buffer containing HTML markup directly to the output, without escaping special characters.

Writes a buffer containing HTML markup directly to the output, without escaping special characters.

WriteMarkupText ( string value ) : void

Write a string containing HTML markup directly to the output, without escaping special characters.

Writes a string containing HTML markup directly to the output, without escaping special characters.

WriteStartTag ( HtmlTagId id ) : void

Write a start tag.

Writes a start tag.

WriteStartTag ( string name ) : void

Write a start tag.

Writes a start tag.

WriteText ( char buffer, int index, int count ) : void

Write text to the output stream, escaping special characters.

Writes text to the output stream, escaping special characters.

WriteText ( string value ) : void

Write text to the output stream, escaping special characters.

Writes text to the output stream, escaping special characters.

WriteToken ( HtmlToken token ) : void

Write a token to the output stream.

Writes a token that was emitted by the HtmlTokenizer to the output stream.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the HtmlWriter and optionally releases the managed resources.

Releases any unmanaged resources used by the HtmlWriter and optionally releases the managed resources.

Private Methods

Method Description
CheckDisposed ( ) : void
EncodeAttribute ( string name, char value, int startIndex, int count ) : void
EncodeAttribute ( string name, string value ) : void
EncodeAttributeName ( string name ) : void
EncodeAttributeValue ( char value, int startIndex, int count ) : void
EncodeAttributeValue ( string value ) : void
ValidateArguments ( char buffer, int index, int count ) : void
ValidateAttributeName ( string name ) : void
ValidateTagName ( string name ) : void

Method Details

Dispose() public method

Releases all resource used by the HtmlKit.HtmlWriter object.
Call Dispose() when you are finished using the HtmlKit.HtmlWriter. The Dispose() method leaves the HtmlKit.HtmlWriter in an unusable state. After calling Dispose(), you must release all references to the HtmlKit.HtmlWriter so the garbage collector can reclaim the memory that the HtmlKit.HtmlWriter was occupying.
public Dispose ( ) : void
return void

Dispose() protected method

Releases the unmanaged resources used by the HtmlWriter and optionally releases the managed resources.
Releases any unmanaged resources used by the HtmlWriter and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; /// false to release only the unmanaged resources.
return void

Flush() public method

Flush any remaining state to the output stream.
Flushes any remaining state to the output stream.
/// The has been disposed. ///
public Flush ( ) : void
return void

HtmlWriter() public method

Initializes a new instance of the HtmlKit.HtmlWriter class.
Creates a new HtmlWriter.
/// is null. /// -or- /// is null. ///
public HtmlWriter ( Stream stream, Encoding encoding ) : System
stream Stream The output stream.
encoding System.Text.Encoding The encoding to use for the output.
return System

HtmlWriter() public method

Initializes a new instance of the HtmlKit.HtmlWriter class.
Creates a new HtmlWriter.
/// is null. ///
public HtmlWriter ( TextWriter output ) : System
output System.IO.TextWriter The output text writer.
return System

WriteAttribute() public method

Write the attribute to the output stream.
Writes the attribute to the output stream.
/// is null. /// /// The is not in a state that allows writing attributes. /// /// The has been disposed. ///
public WriteAttribute ( HtmlAttribute attribute ) : void
attribute HtmlAttribute The attribute.
return void

WriteAttribute() public method

Write the attribute to the output stream.
Writes the attribute to the output stream.
/// is not a valid HTML attribute identifier. /// /// is null. /// /// is less than zero or greater than the length of /// . /// -or- /// and do not specify /// a valid range in the . /// /// The is not in a state that allows writing attributes. /// /// The has been disposed. ///
public WriteAttribute ( HtmlAttributeId id, char buffer, int index, int count ) : void
id HtmlAttributeId The attribute identifier.
buffer char A buffer containing the attribute value.
index int The starting index of the attribute value.
count int The number of characters in the attribute value.
return void

WriteAttribute() public method

Write the attribute to the output stream.
Writes the attribute to the output stream.
/// is not a valid HTML attribute identifier. /// /// is null. /// /// The is not in a state that allows writing attributes. /// /// The has been disposed. ///
public WriteAttribute ( HtmlAttributeId id, string value ) : void
id HtmlAttributeId The attribute identifier.
value string The attribute value.
return void

WriteAttribute() public method

Write the attribute to the output stream.
Writes the attribute to the output stream.
/// is null. /// -or- /// is null. /// /// is less than zero or greater than the length of /// . /// -or- /// and do not specify /// a valid range in the . /// /// is an invalid attribute name. /// /// The is not in a state that allows writing attributes. /// /// The has been disposed. ///
public WriteAttribute ( string name, char buffer, int index, int count ) : void
name string The attribute name.
buffer char A buffer containing the attribute value.
index int The starting index of the attribute value.
count int The number of characters in the attribute value.
return void

WriteAttribute() public method

Write the attribute to the output stream.
Writes the attribute to the output stream.
/// is null. /// -or- /// is null. /// /// is an invalid attribute name. /// /// The is not in a state that allows writing attributes. /// /// The has been disposed. ///
public WriteAttribute ( string name, string value ) : void
name string The attribute name.
value string The attribute value.
return void

WriteAttributeName() public method

Write the attribute name to the output stream.
Writes the attribute name to the output stream.
/// is not a valid HTML attribute identifier. /// /// The is not in a state that allows writing attributes. /// /// The has been disposed. ///
public WriteAttributeName ( HtmlAttributeId id ) : void
id HtmlAttributeId The attribute identifier.
return void

WriteAttributeName() public method

Write the attribute name to the output stream.
Writes the attribute name to the output stream.
/// is null. /// /// is an invalid attribute name. /// /// The is not in a state that allows writing attributes. /// /// The has been disposed. ///
public WriteAttributeName ( string name ) : void
name string The attribute name.
return void

WriteAttributeValue() public method

Write the attribute value to the output stream.
Writes the attribute value to the output stream.
/// is null. /// /// is less than zero or greater than the length of /// . /// -or- /// and do not specify /// a valid range in the . /// /// The is not in a state that allows writing attribute values. /// /// The has been disposed. ///
public WriteAttributeValue ( char buffer, int index, int count ) : void
buffer char A buffer containing the attribute value.
index int The starting index of the attribute value.
count int The number of characters in the attribute value.
return void

WriteAttributeValue() public method

Write the attribute value to the output stream.
Writes the attribute value to the output stream.
/// is null. /// /// The is not in a state that allows writing attribute values. /// /// The has been disposed. ///
public WriteAttributeValue ( string value ) : void
value string The attribute value.
return void

WriteEmptyElementTag() public method

Write an empty element tag.
Writes an empty element tag.
/// is not a valid HTML tag identifier. /// /// The has been disposed. ///
public WriteEmptyElementTag ( HtmlTagId id ) : void
id HtmlTagId The HTML tag identifier.
return void

WriteEmptyElementTag() public method

Write an empty element tag.
Writes an empty element tag.
/// is null. /// /// is not a valid HTML tag. /// /// The has been disposed. ///
public WriteEmptyElementTag ( string name ) : void
name string The name of the HTML tag.
return void

WriteEndTag() public method

Write an end tag.
Writes an end tag.
/// is not a valid HTML tag identifier. /// /// The has been disposed. ///
public WriteEndTag ( HtmlTagId id ) : void
id HtmlTagId The HTML tag identifier.
return void

WriteEndTag() public method

Write an end tag.
Writes an end tag.
/// is null. /// /// is not a valid HTML tag. /// /// The has been disposed. ///
public WriteEndTag ( string name ) : void
name string The name of the HTML tag.
return void

WriteMarkupText() public method

Write a buffer containing HTML markup directly to the output, without escaping special characters.
Writes a buffer containing HTML markup directly to the output, without escaping special characters.
/// is null. /// /// is less than zero or greater than the length of /// . /// -or- /// and do not specify /// a valid range in the . /// /// The has been disposed. ///
public WriteMarkupText ( char buffer, int index, int count ) : void
buffer char The buffer containing HTML markup.
index int The index of the first character to write.
count int The number of characters to write.
return void

WriteMarkupText() public method

Write a string containing HTML markup directly to the output, without escaping special characters.
Writes a string containing HTML markup directly to the output, without escaping special characters.
/// is null. /// /// The has been disposed. ///
public WriteMarkupText ( string value ) : void
value string The string containing HTML markup.
return void

WriteStartTag() public method

Write a start tag.
Writes a start tag.
/// is not a valid HTML tag identifier. /// /// The has been disposed. ///
public WriteStartTag ( HtmlTagId id ) : void
id HtmlTagId The HTML tag identifier.
return void

WriteStartTag() public method

Write a start tag.
Writes a start tag.
/// is null. /// /// is not a valid HTML tag. /// /// The has been disposed. ///
public WriteStartTag ( string name ) : void
name string The name of the HTML tag.
return void

WriteText() public method

Write text to the output stream, escaping special characters.
Writes text to the output stream, escaping special characters.
/// is null. /// /// is less than zero or greater than the length of /// . /// -or- /// and do not specify /// a valid range in the . /// /// The has been disposed. ///
public WriteText ( char buffer, int index, int count ) : void
buffer char The text buffer.
index int The index of the first character to write.
count int The number of characters to write.
return void

WriteText() public method

Write text to the output stream, escaping special characters.
Writes text to the output stream, escaping special characters.
/// is null. /// /// The has been disposed. ///
public WriteText ( string value ) : void
value string The text.
return void

WriteToken() public method

Write a token to the output stream.
Writes a token that was emitted by the HtmlTokenizer to the output stream.
/// is null. /// /// The has been disposed. ///
public WriteToken ( HtmlToken token ) : void
token HtmlToken The HTML token.
return void