smartStartTag

inline fun XmlWriter.smartStartTag(qName: QName, body: XmlWriter.() -> Unit)

Enhanced function for writing start tags, that will attempt to reuse prefixes.


Enhanced function for writing start tags, that will attempt to reuse prefixes. Rather than use the passed prefix it will look up the prefix for the given namespace, and if present use that. It will also ensure to write the appropriate namespace attribute if needed. If the namespace is the default/null, xml or the xmlns namespace the implementation will be as expected.

Return

The actually used prefix

Parameters

nsUri

The namespace to use

localName

The local name to use

prefix

A hint (if not null) for the prefix to use.


inline fun XmlWriter.smartStartTag(nsUri: String?, localName: String, prefix: String? = null, body: XmlWriter.() -> Unit)

Helper function for writing tags that will automatically write the end tag. Otherwise uses the version that does not take a body parameter.