XmlNode<ObjectType> class abstract interface

Represents a node in an XML document tree (DOM-like structure).

An XmlNode provides both hierarchical navigation and direct access to XML element data, supporting attributes, text content, and child elements.

Node Types

  • Element nodes - Represent XML elements with attributes and children
  • Text nodes - Contain text content between elements
  • Attribute nodes - Represent XML attributes
  • Document nodes - Represent the root of the XML tree
final root = tree.get('users');
final firstUser = root.get('user[0]');
final name = firstUser.get('name').getText();

Example

final xml = '<root><child attr="value">text</child></root>';
final tree = parser.readTree(xml);
final child = tree.get('child');

print(child.getText()); // "text"
print(child.getAttribute('attr')); // "value"
Implemented types
Annotations
  • @Generic.new(XmlNode)

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

get(String name) → XmlNode?
Returns the child element with the given name.
getAll(String name) → List<XmlNode>
Returns all child elements with the given name.
getAttribute(String name) → String?
Returns the value of an attribute by name.
getAttributes() → Map<String, String>
Returns all attributes of this element as a map.
getChildren() → List<XmlNode>
Returns the list of all child nodes.
getName() → String?
Returns the name of this element.
getParent() → XmlNode?
Returns the parent node of this node.
getText() → String?
Returns the text content of this node.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toObject() → ObjectType
Generic interface representing a parsed node in Jetleaf's structured data model (JSON/YAML/other).
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited