Table of Contents

Class XmlGeneratorHtml

Namespace
SunamoHtml._public.SunamoXml.Generators
Assembly
SunamoHtml.dll

XML/HTML generator that builds XML/HTML content using a StringBuilder.

public class XmlGeneratorHtml
Inheritance
XmlGeneratorHtml
Derived
Inherited Members
Extension Methods

Constructors

XmlGeneratorHtml()

Initializes a new instance of the XmlGeneratorHtml class without stack usage.

public XmlGeneratorHtml()

XmlGeneratorHtml(bool)

Initializes a new instance of the XmlGeneratorHtml class.

public XmlGeneratorHtml(bool isUseStack)

Parameters

isUseStack bool

Whether to use a stack to track opened tags.

Properties

StringBuilder

Gets or sets the StringBuilder used to build the XML/HTML content.

public StringBuilder StringBuilder { get; set; }

Property Value

StringBuilder

Methods

AppendLine()

Appends a line terminator to the StringBuilder.

public void AppendLine()

EndComment()

Ends an HTML comment.

public void EndComment()

Insert(int, string)

Inserts text at the specified index in the StringBuilder.

public void Insert(int index, string text)

Parameters

index int

The index to insert at.

text string

The text to insert.

Length()

Returns the current length of the generated content.

public int Length()

Returns

int

The length of the StringBuilder content.

StartComment()

Starts an HTML comment.

public void StartComment()

TerminateTag(string)

CZ: Zapíše zavírací tag.

public void TerminateTag(string tagName)

Parameters

tagName string

The tag name to close.

ToString()

Returns the generated XML/HTML content as a string.

public override string ToString()

Returns

string

The complete XML/HTML content.

WriteCData(string)

CZ: Zapíše CDATA sekci se zadaným obsahem.

public void WriteCData(string innerCData)

Parameters

innerCData string

The content inside the CDATA section.

WriteElement(string, string)

CZ: Zapíše kompletní element s otevíracím tagem, vnitřním obsahem a zavíracím tagem.

public void WriteElement(string tagName, string innerContent)

Parameters

tagName string

The tag name.

innerContent string

The inner content.

CZ: Zapíše odkaz (anchor element).

[SuppressMessage("Design", "CA1054:UriParametersShouldNotBeStrings")]
public void WriteLink(string link, string innerText)

Parameters

link string

The href URL.

innerText string

The link text.

WriteNonPairTag(string)

CZ: Zapíše nepárový tag bez atributů.

public void WriteNonPairTag(string tagName)

Parameters

tagName string

The tag name.

WriteNonPairTagWith2Attrs(string, string, string, string, string)

CZ: Zapíše nepárový tag se dvěma atributy.

public void WriteNonPairTagWith2Attrs(string tagName, string attribute1Name, string attribute1Value, string attribute2Name, string attribute2Value)

Parameters

tagName string

The tag name.

attribute1Name string

The first attribute name.

attribute1Value string

The first attribute value.

attribute2Name string

The second attribute name.

attribute2Value string

The second attribute value.

WriteNonPairTagWithAttr(string, string, string)

CZ: Zapíše nepárový tag s jedním atributem.

public void WriteNonPairTagWithAttr(string tagName, string attributeName, string attributeValue)

Parameters

tagName string

The tag name.

attributeName string

The attribute name.

attributeValue string

The attribute value.

WriteNonPairTagWithAttrs(bool, string, params string[])

CZ: Zapíše nepárový tag s více atributy, volitelně připojí null hodnoty.

public void WriteNonPairTagWithAttrs(bool isAppendNull, string tagName, params string[] attributes)

Parameters

isAppendNull bool

Whether to append null values.

tagName string

The tag name.

attributes string[]

Attribute name-value pairs (alternating name, value).

WriteNonPairTagWithAttrs(string, IList<string>)

CZ: Zapíše nepárový tag s více atributy.

public void WriteNonPairTagWithAttrs(string tagName, IList<string> attributes)

Parameters

tagName string

The tag name.

attributes IList<string>

List of attribute name-value pairs (alternating name, value).

WriteNonPairTagWithAttrs(string, params string[])

CZ: Zapíše nepárový tag s více atributy.

public void WriteNonPairTagWithAttrs(string tagName, params string[] attributes)

Parameters

tagName string

The tag name.

attributes string[]

Attribute name-value pairs (alternating name, value).

WriteRaw(string)

Writes raw text to the StringBuilder without any formatting.

public void WriteRaw(string text)

Parameters

text string

The text to write.

WriteTag(string)

CZ: Zapíše otevírací tag bez atributů.

public void WriteTag(string tagName)

Parameters

tagName string

The tag name.

WriteTagNamespaceManager(string, XmlNamespaceManager, params string[])

CZ: Zapíše otevírací tag s XML namespace managerem a dalšími atributy.

public void WriteTagNamespaceManager(string tagName, XmlNamespaceManager namespaceManager, params string[] attributes)

Parameters

tagName string

The tag name.

namespaceManager XmlNamespaceManager

The XML namespace manager.

attributes string[]

Additional attribute name-value pairs (alternating name, value).

WriteTagWith2Attrs(string, string, string, string, string)

CZ: Zapíše otevírací tag se dvěma atributy. ZASTARALÉ: Použijte WriteTagWithAttrs.

[Obsolete("only WriteTagWithAttrs should be used anymore")]
public void WriteTagWith2Attrs(string tagName, string attribute1Name, string attribute1Value, string attribute2Name, string attribute2Value)

Parameters

tagName string

The tag name.

attribute1Name string

The first attribute name.

attribute1Value string

The first attribute value.

attribute2Name string

The second attribute name.

attribute2Value string

The second attribute value.

WriteTagWithAttr(string, string, string, bool)

CZ: Zapíše otevírací tag s jedním atributem. ZASTARALÉ: Použijte WriteTagWithAttrs.

[Obsolete("only WriteTagWithAttrs should be used anymore")]
public void WriteTagWithAttr(string tagName, string attributeName, string attributeValue, bool isSkipEmptyOrNull = false)

Parameters

tagName string

The tag name.

attributeName string

The attribute name.

attributeValue string

The attribute value.

isSkipEmptyOrNull bool

Whether to skip writing if value is empty or null.

WriteTagWithAttrs(string, IList<string>)

CZ: Zapíše otevírací tag s více atributy.

public void WriteTagWithAttrs(string tagName, IList<string> attributes)

Parameters

tagName string

The tag name.

attributes IList<string>

List of attribute name-value pairs (alternating name, value).

WriteTagWithAttrs(string, params string[])

CZ: Zapíše otevírací tag s více atributy.

public void WriteTagWithAttrs(string tagName, params string[] attributes)

Parameters

tagName string

The tag name.

attributes string[]

Attribute name-value pairs (alternating name, value).

WriteTagWithAttrsCheckNull(string, params string[])

CZ: Zapíše otevírací tag s atributy, kontroluje null hodnoty.

public void WriteTagWithAttrsCheckNull(string tagName, params string[] attributes)

Parameters

tagName string

The tag name.

attributes string[]

Attribute name-value pairs (alternating name, value).

WriteXmlDeclaration()

Writes the XML declaration.

public void WriteXmlDeclaration()