addChildValue method
Adds a child element with text content (like <name>value</name>)
Implementation
LSLXmlNode addChildValue(String name, String value) {
if (name.isEmpty) {
throw LSLException('Child name cannot be empty');
}
lsl_append_child_value(
xmlPtr,
name.toNativeUtf8(allocator: allocate).cast<Char>(),
value.toNativeUtf8(allocator: allocate).cast<Char>(),
);
// Get the last child, which should be the one we just added
final lastChildPtr = lsl_last_child(xmlPtr);
if (lastChildPtr.isNullPointer) {
throw LSLException('Failed to add child value: $name');
}
return LSLXmlNode.fromXmlPtr(lastChildPtr);
}