xml_annotator library

Classes

XmlAnyElement
A wildcard capturing every child element not claimed by another mapped field. No parameters.
XmlAttribute
Maps a field to an attribute on the element. Same parameters and meanings as XmlElement - including omitEmpty's scalar-only contract (it is a build error on a collection or non-zeroable type) and the auto-derived read fallback that makes a paired defaultValue redundant. A namespace: URI is bound at the use-site and auto-declared at the root by the hoist walk; its write prefix is resolved from the class @XmlSerializer(namespaces: ...) map, with prefix: an optional per-field override that requires a namespace:.
XmlBuilder
A builder to create XML trees with code.
XmlElement
Maps a field to a child element. This is the default: a public field with no node-kind annotation is treated as @XmlElement, named via the class fieldRename.
XmlElementConverter<T>
The raw-element escape hatch: full control over a whole element when its shape (attributes, children, conditional namespaces) genuinely cannot be described declaratively. Reach for it only for un-mappable bodies - anything expressible as @XmlAttribute/@XmlElement fields should stay plain @XmlSerializer. readElement receives the matched element; buildElementBody is given a builder positioned inside the already-open element.
XmlEnum
Annotates a Dart enum, paired with XmlValue on each constant. unknownValue is the constant to fall back to when an inbound literal matches no XmlValue; null => an unknown literal is an error on read.
XmlIgnore
Opts a field out of mapping: a public field carrying this is neither read nor written. No parameters.
XmlInnerXml
Maps a String field to the element's raw, unparsed inner XML, read and written back verbatim. No parameters.
XmlRoot
Declares a type's own XML element identity. Carried only by a type that can stand as a document root; a nested type carries just XmlSerializer and is named by its use-site.
XmlSerializer
Marks a class for XML serialization code generation and holds its class-wide options. Carried by every mapped type, root or nested.
XmlText
Maps a field to the element's character data (text). A text node has no name and no namespace/prefix, so it carries only omitEmpty. With the default false, an empty string still emits <t></t>.
XmlValue
Annotates one enum constant with its serialized form. Every constant must map to some literal.
XmlValueConverter<T>
Controls the string form of a single attribute or text value. The XML wire form is always a String, so there is one type parameter.

Enums

FieldRename
How to derive an XML node's default name from a Dart field name, when no explicit name: is given on the node-kind annotation.

Typedefs

XmlElementNode = XmlElement