Class XmlWriter

Defines a writer that provides a set of methods to append text in XML format. Use the static SP.XmlWriter.create(sb) Method to create an SP.XmlWriter object with the Sys.StringBuilder object you pass in.

Index

Methods

Methods

public close()

This member is reserved for internal use and is not intended to be used directly from your code.

public static create(sb: StringBuilder): XmlWriter

Creates a new instance of the XmlWriter class with the specified string builder.

Parameters

Returns

XmlWriter

public writeAttributeString(localName: string, value: string)

Appends an attribute with the specified name and value in XML format to the object?s string builder.

Parameters

  • localName: string
  • value: string

public writeElementString(tagName: string, value: string)

Appends an element with the specified tag name and value in XML format to the string builder.

Parameters

  • tagName: string
  • value: string

public writeEndAttribute()

Appends an end of an attribute in XML format to the object?s string builder.

public writeEndElement()

Appends an end element tag in XML format to the object?s string builder. This method appends the end element tag ?/>? if the start element tag is not closed; otherwise, it appends a full end element tag ?? to the string builder.

public writeRaw(xml: string)

Appends the specified text to the object?s string builder.

Parameters

  • xml: string

public writeStartAttribute(localName: string)

This method only appends the name of the attribute. You can append the value of the attribute by calling the SP.XmlWriter.writeString(value) Method, and close the attribute by calling the SP.XmlWriter.writeEndAttribute() Method.

Parameters

  • localName: string

public writeStartElement(tagName: string)

Appends a start element tag with the specified name in XML format to the object?s string builder.

Parameters

  • tagName: string

public writeString(value: string)

Appends the specified value for an element tag or attribute to the object?s string builder.

Parameters

  • value: string