Table of Contents

Interface IXmlGenerator

Namespace
SunamoInterfaces.Interfaces
Assembly
SunamoInterfaces.dll

Interface for generating XML content.

public interface IXmlGenerator
Extension Methods

Methods

AppendLine()

Appends a new line to the XML output.

void AppendLine()

EndComment()

Ends an XML comment.

void EndComment()

Insert(int, string)

Inserts text at the specified index.

void Insert(int index, string text)

Parameters

index int

The index at which to insert.

text string

The text to insert.

Length()

Gets the length of the generated XML.

int Length()

Returns

int

The length of the XML content.

StartComment()

Starts an XML comment.

void StartComment()

TerminateTag(string)

Terminates (closes) an XML tag.

void TerminateTag(string tagName)

Parameters

tagName string

The name of the tag to terminate.

ToString()

Converts the generated XML to a string.

string ToString()

Returns

string

The XML content as a string.

WriteCData(string)

Writes a CDATA section.

void WriteCData(string content)

Parameters

content string

The content of the CDATA section.

WriteElement(string, string)

Writes an XML element with inner content.

void WriteElement(string elementName, string content)

Parameters

elementName string

The element name.

content string

The inner content.

WriteNonPairTag(string)

Writes a self-closing (non-pair) XML tag.

void WriteNonPairTag(string tagName)

Parameters

tagName string

The tag name.

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

Writes a self-closing tag with two attributes.

void WriteNonPairTagWith2Attrs(string tagName, string firstName, string firstValue, string secondName, string secondValue)

Parameters

tagName string

The tag name.

firstName string

The first attribute name.

firstValue string

The first attribute value.

secondName string

The second attribute name.

secondValue string

The second attribute value.

WriteNonPairTagWithAttr(string, string, string)

Writes a self-closing tag with one attribute.

void WriteNonPairTagWithAttr(string tagName, string attrName, string attrValue)

Parameters

tagName string

The tag name.

attrName string

The attribute name.

attrValue string

The attribute value.

WriteNonPairTagWithAttrs(bool, string, params string[])

Writes a self-closing tag with multiple attributes, optionally appending null attributes.

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

Parameters

isAppendingNull bool

Whether to append null attributes.

tagName string

The tag name.

attributes string[]

The attributes as name-value pairs.

WriteNonPairTagWithAttrs(string, List<string>)

Writes a self-closing tag with attributes from a list.

void WriteNonPairTagWithAttrs(string tagName, List<string> attributes)

Parameters

tagName string

The tag name.

attributes List<string>

The list of attributes as name-value pairs.

WriteNonPairTagWithAttrs(string, params string[])

Writes a self-closing tag with multiple attributes.

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

Parameters

tagName string

The tag name.

attributes string[]

The attributes as name-value pairs.

WriteRaw(string)

Writes raw XML content without escaping.

void WriteRaw(string content)

Parameters

content string

The raw content to write.

WriteTag(string)

Writes an opening XML tag.

void WriteTag(string tagName)

Parameters

tagName string

The tag name.

WriteTagNamespaceManager(object, XmlNamespaceManager, string, string)

Writes a tag with namespace manager and element.

void WriteTagNamespaceManager(object element, XmlNamespaceManager namespaceManager, string namespaceUri, string prefix)

Parameters

element object

The element object.

namespaceManager XmlNamespaceManager

The namespace manager.

namespaceUri string

The namespace URI.

prefix string

The namespace prefix.

WriteTagNamespaceManager(string, XmlNamespaceManager, params string[])

Writes a tag with namespace manager and attributes.

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

Parameters

tagName string

The tag name.

namespaceManager XmlNamespaceManager

The namespace manager.

attributes string[]

The attributes as name-value pairs.

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

Writes an opening tag with two attributes.

void WriteTagWith2Attrs(string tagName, string firstName, string firstValue, string secondName, string secondValue)

Parameters

tagName string

The tag name.

firstName string

The first attribute name.

firstValue string

The first attribute value.

secondName string

The second attribute name.

secondValue string

The second attribute value.

WriteTagWithAttr(string, string, string, bool)

Writes an opening tag with one attribute, optionally skipping if empty or null.

void WriteTagWithAttr(string tagName, string attributeName, string attributeValue, bool isSkippingEmptyOrNull = false)

Parameters

tagName string

The tag name.

attributeName string

The attribute name.

attributeValue string

The attribute value.

isSkippingEmptyOrNull bool

Whether to skip if attribute value is empty or null.

WriteTagWithAttrs(string, List<string>)

Writes an opening tag with attributes from a list.

void WriteTagWithAttrs(string tagName, List<string> attributes)

Parameters

tagName string

The tag name.

attributes List<string>

The list of attributes as name-value pairs.

WriteTagWithAttrs(string, params string[])

Writes an opening tag with multiple attributes.

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

Parameters

tagName string

The tag name.

attributes string[]

The attributes as name-value pairs.

WriteTagWithAttrsCheckNull(string, params string[])

Writes an opening tag with attributes, checking for null values.

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

Parameters

tagName string

The tag name.

attributes string[]

The attributes as name-value pairs.

WriteXmlDeclaration()

Writes the XML declaration.

void WriteXmlDeclaration()