new XMLWriter(documentopt, optionsopt)
Creates a new XML writer
Name | Type | Attributes | Description |
---|---|---|---|
document | $k.AbstractTextDocument | <optional> | Document to write on. A new text document will be created if not specified |
options | object | <optional> | Options
SAX interface for writing XML. An XMLWriter is created by sending xmlWriter() to a document. |
- Version
- Experimental feature, might be removed at any time
- Since
- 4.3.1
Methods
attribute(localName, value, prefixopt)
Writes an attribute of a tag to the document
Name | Type | Attributes | Description |
---|---|---|---|
localName | string | Local name of the attribute | |
value | string | Value of the attribute | |
prefix | string | <optional> | Namespace prefix. The writer does not check if it is bound to a namespace |
If writing the attribute is not possible
cdata(characters)
Writes a CDATA section to the document
Name | Type | Description |
---|---|---|
characters | string |
If writing the CData is not possible
characters(characters)
Writes a string to the document
Name | Type | Description |
---|---|---|
characters | string |
If writing the string is not possible
comment(comment)
Writes a comment to the document
Name | Type | Description |
---|---|---|
comment | string |
If writing the comment is not possible
defaultNamespace(namespace)
Write the default namespace of the current tag and its children
Name | Type | Description |
---|---|---|
namespace | string |
If writing the namespace is not possible
document() → {$k.AbstractTextDocument}
Returns the document
- Version
- Experimental feature, might be removed at any time
- Since
- 4.3.1
- Type:
- $k.AbstractTextDocument
endElement()
Closes the currently opened tag
If closing the tag is not possible
print(characters)
Writes a string to the document without any escaping
Name | Type | Description |
---|---|---|
characters | string |
If writing the string is not possible
processingInstruction(target, data)
Writes a processing instruction to the document
Name | Type | Description |
---|---|---|
target | string | |
data | string |
If writing the comment is not possible
setIndent(enableIndentation)
Enable/disable automatic indentation of the XML tags. Default is true
Name | Type | Description |
---|---|---|
enableIndentation | boolean |
setPrefix(prefix, namespace)
Sets the prefix the uri is bound to
Name | Type | Description |
---|---|---|
prefix | string | |
namespace | string |
startElement(localName, prefixopt)
Writes a start tag to the document
Name | Type | Attributes | Description |
---|---|---|---|
localName | string | Local name of the tag | |
prefix | string | <optional> | Namespace prefix. The writer does not check if it is bound to a namespace |
If writing the tag is not possible