XML
Class that provides access to XML parsing and serialization for the Kotlin Serialization system. In most cases the companion functions would be used. Creating an object explicitly however allows for the serialization to be configured.
Note that at this point not all configuration options will work on all platforms.
The serialization can be configured with various annotations: XmlSerialName, XmlChildrenName, XmlPolyChildren, XmlDefault, XmlElement. These control the way the content is actually serialized. Those tags that support being set on types (rather than properties) prefer values set on properties (the property can override settings on the type).
Serialization normally prefers to store values as attributes. This can be overridden by the XmlElement annotation to force a tag child. Similarly XmlValue can be used for the child to be marked as textual content of the parent tag
only one such child is allowed.
Naming of tags and attributes follows some special rules. In particular attributes will be named based on their use where tags are named based on their type. Both can be overridden by specifying XmlSerialName on the property.
When names are not specified on types, their class name is used, but the package is normally omitted if it matches the package name of the class that represents the parent. Attributes get their use site name which is either the property name or the name modified through SerialName
Constructors
Types
Class to support recovery in parsing.
An interface that allows custom serializers to special case being serialized to XML and retrieve the underlying XmlReader. This is used for example by CompactFragment to read arbitrary XML from the stream and store it inside the buffer (without attempting to use the serializer/decoder for it.
An interface that allows custom serializers to special case being serialized to XML and retrieve the underlying XmlWriter. This is used for example by CompactFragment to make the fragment transparent when serializing to XML.
Functions
Parse an object of the type T out of the reader. This function is intended mostly to be used indirectly where though the reified function.
Decode the given string value using the deserializer. It is equivalent to decodeFromReader(deserializer, XmlStreaming.newReader(string))
.
Transform into a string. This function is expected to be called indirectly.
Write the object to the given writer
Transform onto an existing xml writer.