XmlBuilder class
A builder to create XML trees with code.
Constructors
- XmlBuilder({bool optimizeNamespaces = false})
- Construct a new XmlBuilder.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- optimizeNamespaces → bool
-
If optimizeNamespaces is true, the builder will perform some
namespace optimization.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
attribute(
String name, Object value, {String? namespace, XmlAttributeType? attributeType}) → void -
Adds a XmlAttribute node with the provided
name
andvalue
. -
build(
) → XmlNode - Builds and returns the resulting XmlNode; resets the builder to its initial empty state.
-
buildDocument(
) → XmlDocument - Builds and returns the resulting XmlDocument; resets the builder to its initial empty state.
-
buildFragment(
) → XmlDocumentFragment - Builds and returns the resulting XmlDocumentFragment; resets the builder to its initial empty state.
-
cdata(
Object text) → void -
Adds a XmlCDATA node with the provided
text
. -
comment(
Object text) → void -
Adds a XmlComment node with the provided
text
. -
declaration(
{String version = '1.0', String? encoding, Map< String, String> attributes = const {}}) → void - Adds a XmlDeclaration node.
-
doctype(
Object text) → void - Adds a XmlDoctype node.
-
element(
String name, {String? namespace, Map< String, String?> namespaces = const {}, Map<String, String> attributes = const {}, bool isSelfClosing = true, Object? nest}) → void -
Adds a XmlElement node with the provided tag
name
. -
namespace(
String uri, [String? prefix]) → void -
Binds a namespace
prefix
to the provideduri
. Theprefix
can be omitted to declare a default namespace. Throws an ArgumentError if theprefix
is invalid or conflicts with an existing declaration. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processing(
String target, Object text) → void -
Adds a XmlProcessing node with the provided
target
andtext
. -
text(
Object text) → void -
Adds a XmlText node with the provided
text
. -
toString(
) → String -
A string representation of this object.
inherited
-
xml(
String input, {XmlEntityMapping? entityMapping}) → void - Adds a raw XML string. The string will be parsed as XmlDocumentFragment and throws an XmlParserException if the input is invalid.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited