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
isUseStackboolWhether 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
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
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
tagNamestringThe 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
innerCDatastringThe 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
WriteLink(string, string)
CZ: Zapíše odkaz (anchor element).
[SuppressMessage("Design", "CA1054:UriParametersShouldNotBeStrings")]
public void WriteLink(string link, string innerText)
Parameters
WriteNonPairTag(string)
CZ: Zapíše nepárový tag bez atributů.
public void WriteNonPairTag(string tagName)
Parameters
tagNamestringThe 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
tagNamestringThe tag name.
attribute1NamestringThe first attribute name.
attribute1ValuestringThe first attribute value.
attribute2NamestringThe second attribute name.
attribute2ValuestringThe 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
tagNamestringThe tag name.
attributeNamestringThe attribute name.
attributeValuestringThe 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
isAppendNullboolWhether to append null values.
tagNamestringThe tag name.
attributesstring[]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
tagNamestringThe tag name.
attributesIList<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
tagNamestringThe tag name.
attributesstring[]Attribute name-value pairs (alternating name, value).
WriteRaw(string)
Writes raw text to the StringBuilder without any formatting.
public void WriteRaw(string text)
Parameters
textstringThe text to write.
WriteTag(string)
CZ: Zapíše otevírací tag bez atributů.
public void WriteTag(string tagName)
Parameters
tagNamestringThe 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
tagNamestringThe tag name.
namespaceManagerXmlNamespaceManagerThe XML namespace manager.
attributesstring[]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
tagNamestringThe tag name.
attribute1NamestringThe first attribute name.
attribute1ValuestringThe first attribute value.
attribute2NamestringThe second attribute name.
attribute2ValuestringThe 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
tagNamestringThe tag name.
attributeNamestringThe attribute name.
attributeValuestringThe attribute value.
isSkipEmptyOrNullboolWhether 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
tagNamestringThe tag name.
attributesIList<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
tagNamestringThe tag name.
attributesstring[]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
tagNamestringThe tag name.
attributesstring[]Attribute name-value pairs (alternating name, value).
WriteXmlDeclaration()
Writes the XML declaration.
public void WriteXmlDeclaration()