共用方式為


SP.XmlWriter.writeElementString(tagName, value) Method

Applies to: SharePoint Foundation 2010

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

SP.XmlWriter.writeElementString(tagName, value);

Parameters

tagName

Type: String

The name of the element tag.

value

Type: String

The value of the element.

Exceptions

Sys.InvalidOperationException

The tag specified by tagName does not exist.

or

The previous attribute is not closed.

Remarks

This method appends an element that contains a start tag, value and an end tag.

This method calls the SP.XmlWriter.writeStartElement(tagName) Method, the SP.XmlWriter.writeString(value) Method, and the SP.XmlWriter.writeEndElement() Method method to append the element to the string builder.

Applies To

SP.XmlWriter Class

See Also

Reference

SP.XmlWriter Methods

SP Namespace