Class XmlGeneratorNS2
- Namespace
- SunamoXml.Generators
- Assembly
- SunamoXml.dll
Builds namespaced XML content. All generated tags are prefixed with the specified namespace.
public class XmlGeneratorNS2
- Inheritance
-
XmlGeneratorNS2
- Inherited Members
- Extension Methods
Constructors
XmlGeneratorNS2(string)
Initializes a new instance with the specified namespace prefix.
public XmlGeneratorNS2(string xmlNamespace)
Parameters
xmlNamespacestringThe namespace prefix to prepend to all tags.
Fields
stringBuilder
The underlying StringBuilder that holds the generated XML content.
protected StringBuilder stringBuilder
Field Value
Methods
TerminateTag(string)
Writes a closing tag for the specified element.
public void TerminateTag(string tagName)
Parameters
tagNamestringThe element name to close.
ToString()
Returns the generated XML content as a string with normalized spacing.
public override string ToString()
Returns
WriteCData(string)
Writes a CDATA section with the specified content.
public void WriteCData(string innerCData)
Parameters
innerCDatastringThe content to wrap in CDATA.
WriteElement(string, string)
Writes a complete element with the specified inner content.
public void WriteElement(string elementName, string inner)
Parameters
WriteElementCData(string, string)
Writes a complete element with the inner content wrapped in a CDATA section.
public void WriteElementCData(string elementName, string cdata)
Parameters
WriteElementObject(string, object)
Writes a complete element with the object's string representation as inner content. Skips if the value is null.
public void WriteElementObject(string elementName, object value)
Parameters
elementNamestringThe element name.
valueobjectThe object whose string representation becomes the inner content.
WriteRaw(string)
Writes raw content directly to the output.
public void WriteRaw(string rawContent)
Parameters
rawContentstringThe raw content to append.
WriteSimpleTag(string)
Writes a self-closing tag without attributes.
public void WriteSimpleTag(string tagName)
Parameters
tagNamestringThe element name.
WriteSimpleTag(string, params string[])
Writes a self-closing tag with multiple attributes.
public void WriteSimpleTag(string tagName, params string[] attributes)
Parameters
WriteSimpleTagS(string, string, params string[])
Creates a self-closing tag string with the specified namespace, tag name, and optional attributes.
public static string WriteSimpleTagS(string xmlNamespace, string tagName, params string[] attributes)
Parameters
xmlNamespacestringThe namespace prefix.
tagNamestringThe element name.
attributesstring[]Alternating attribute names and values.
Returns
WriteTag(string)
Writes an opening tag for the specified element.
public void WriteTag(string tagName)
Parameters
tagNamestringThe element name.
WriteTagWith2Attrs(string, string, string, string, string)
Writes an opening tag with two attributes.
public void WriteTagWith2Attrs(string tagName, string firstName, string firstValue, string secondName, string secondValue)
Parameters
tagNamestringThe element name.
firstNamestringThe first attribute name.
firstValuestringThe first attribute value.
secondNamestringThe second attribute name.
secondValuestringThe second attribute value.
WriteTagWithAttr(string, string, string)
Writes an opening tag with one attribute.
public void WriteTagWithAttr(string tagName, string attributeName, string attributeValue)
Parameters
tagNamestringThe element name.
attributeNamestringThe attribute name.
attributeValuestringThe attribute value.
WriteTagWithAttrs(string, params string[])
Writes an opening tag with multiple attributes.
public void WriteTagWithAttrs(string tagName, params string[] attributes)
Parameters
WriteXmlDeclaration()
Writes the standard XML declaration to the output.
public void WriteXmlDeclaration()