Namespace - LJCNetCommon
Syntax
C# |
public class HTMLBuilder
|
Provides methods for creating HTML text.
Remarks
The HTMLBuilder class is designed for creating HTML text. It is similar
in principle to the StringBuilder class which is designed for creating
strings.
The HTMLBuilder class - like the StringBuilder class - stores the text
internally. The text is retrieved with the ToString() method.
Add Text Methods
The "Add" methods are similar to StringBuilder methods:
AddLine() - StringBuilder.AppendLine()
AddText() - StringBuilder.Append()
"Add" methods add text to the builder unmodified except for AddLine()
which appends a newline.
Append Text Methods
Line(), Text()
"Append" methods add the potentially indented and wrapped text to the
builder.
The Text() method creates the added text without an ending newline This
behavior is done for consistency and it allows the developer to append to
the existing text.
"Append" methods start the text with a newline if the builder already has
text, param allowNewLine = true and builder text does not end with a
newline.
The Line() and Text() methods should have the addIndent property set to
false if it applies text retrieved with a "Get" method as the "Get" method
has already applied the indent.
The AddIndent() method manually controls the current indent count.
The indent string length is calculated with the properties
(IndentCount * IndentCharCount) and can be retrieved with the
IndentLength property.
Get Text Methods
GetLine(), GetText()
All "Get" methods create and return the potentialy indented and
wrapped text but do not add it to the builder.
Append Element Methods
Begin(), Create(), End()
These methods append element tags and content. Begin() automatically
increments the IndentCount by 1. Create() also increments the IndentCount
by 1 if the isEmpty parameter is false and the close parameter is false.
End() automatically decrements the IndentCount by 1 if the IndentCount
is currently greater than zero.
The "Append" element methods create the added text without an ending
newline. This behavior is done for consistency and it allows the developer
to append to the existing text.
"Append" methods start the text with a newline if the builder already has
text, param allowNewLine = true and builder text does not end with a
newline.
Other Append Element Methods
Link(), Meta(), Metas(), Script()
These methods also append elements but do not change the IndentCount
value.
The "Append" element methods create the added text without an ending
newline. This behavior is done for consistency and it allows the developer
to append to the existing text.
"Append" methods start the text with a newline if the builder already has
text, param allowNewLine = true and builder text does not end with a
newline.
Get Element Methods
GetBegin(), GetCreate(), GetEnd(), GetLink(), GetMeta(), GetMetas()
, GetScript()
All "Get" methods create and return the potentialy indented and wrapped
text but do not add it to the builder.
Constructor
#ctor
|
Initializes an object instance. |
Data
ToString
|
Implements the ToString() method. |
Methods
AddIndent
|
Changes the IndentCount by the supplied value. |
Append Text
AddLine
|
Adds a text line without modification. |
AddText
|
Adds text without modification. |
Line
|
Adds a modified text line to the builder. |
Text
|
Adds modified text to the builder. |
Get Text
Append Element
Begin
|
Appends the element begin tag. |
Create
|
Appends an element. |
End
|
Appends the element end tag. |
Link
|
Appends a <link> element for a style sheet. |
Meta
|
Appends a <meta> element. |
Metas
|
Appends common <meta&rt; elements. |
Script
|
Appends a <script> element. |
Get Element
Append HTML
HTMLBegin
|
Creates the HTML beginning up to and including head;. |
Get HTML
Get Attributes
Other Public Methods
37 Methods
Other Private Methods
1 Methods
Properties
Fields
Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.