Provides structured, incremental XML output for JetLeaf's serialization engine.
The XmlGenerator supports element boundaries, attributes, text content, and raw XML injection for custom serialization cases.
Example
final generator = StringXmlGenerator();
generator.writeStartElement('user');
generator.writeAttribute('id', '1');
generator.writeStartElement('name');
generator.writeText('Alice');
generator.writeEndElement(); // name
generator.writeEndElement(); // user
print(generator.toXmlString());
// Output: <user id="1"><name>Alice</name></user>
- Implemented types
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → FutureOr< void> -
Closes this resource, relinquishing any underlying resources.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
writeAttribute(
String name, String value) → void -
Writes an attribute with the given
nameandvalue. Must be called immediately after writeStartElement. -
writeEndElement(
) → void - Writes the end of the current XML element.
-
writeNull(
) → void - Writes a null value (typically as empty element or omitted).
-
writeStartElement(
String name) → void -
Writes the start of an XML element with the given
name. -
writeString(
String value) → void -
Writes a string value.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
CLASS
→ Class<
XmlGenerator> -
final