LSLXmlNode class

An XML node in LibLSL's metadata structure.

This class represents a unified XML node that can contain both text content and child elements, matching LibLSL's C API behavior. Unlike separate element and text node classes, this unified approach handles both <name>value</name> and <name><child/></name> patterns seamlessly.

Key Features:

Example Usage:

final root = description.value;

// Add text content: <manufacturer>SCCN</manufacturer>
root.addChildValue('manufacturer', 'SCCN');

// Add container element: <channels></channels>
final channels = root.addChildElement('channels');

// Add nested structure
final channel = channels.addChildElement('channel');
channel.addChildValue('label', 'C3');
Inheritance

Constructors

LSLXmlNode.fromXmlPtr(lsl_xml_ptr xmlPtr)
factory

Properties

children → List<LSLXmlNode>
Gets child elements of this element
no setter
hashCode → int
The hash code for this object.
no setteroverride
name ↔ String
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
textValue ↔ String
Gets the text value of this element (if it has text content)
getter/setter pair
xmlPtr → lsl_xml_ptr
The underlying LibLSL XML pointer.
finalinherited

Methods

addChildElement(String name) → LSLXmlNode
Adds a child element (like <name></name>)
addChildValue(String name, String value) → LSLXmlNode
Adds a child element with text content (like <name>value</name>)
appendCopy(LSLXml node) → LSLXmlNode
Appends a deep copy of node (which may live in another stream info's description) as the last child; returns the copy.
childNamed(String name) → LSLXmlNode?
inherited
childValueNamed(String name) → String
Text content of the first child element named name (empty if there is no such child or it has no text).
firstChild() → LSLXmlNode?
inherited
isEmpty() → bool
inherited
isText() → bool
inherited
lastChild() → LSLXmlNode?
inherited
nextSibling() → LSLXmlNode?
inherited
nextSiblingNamed(String name) → LSLXmlNode?
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parent() → LSLXmlNode?
inherited
prependChildElement(String name) → LSLXmlNode
Inserts an empty child element as the first child (like addChildElement, which appends).
prependChildValue(String name, String value) → LSLXmlNode
Inserts a child element with text content as the first child (like addChildValue, which appends).
prependCopy(LSLXml node) → LSLXmlNode
Inserts a deep copy of node as the first child; returns the copy.
previousSibling() → LSLXmlNode?
inherited
previousSiblingNamed(String name) → LSLXmlNode?
inherited
removeChild(LSLXml child) → void
Removes child (a direct child of this node) and its subtree.
removeChildNamed(String name) → void
Removes the first child element named name (no-op if none).
setChildValue(String name, String value) → bool
Replaces the text content of the first child element named name.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
check equality based on pointer address
override