addChildElement method

LSLXmlNode addChildElement(
  1. String name
)

Adds a child element (like <name></name>)

Implementation

LSLXmlNode addChildElement(String name) {
  if (name.isEmpty) {
    throw LSLException('Child name cannot be empty');
  }
  final childPtr = lsl_append_child(
    xmlPtr,
    name.toNativeUtf8(allocator: allocate).cast<Char>(),
  );
  if (childPtr.isNullPointer) {
    throw LSLException('Failed to add child element: $name');
  }
  return LSLXmlNode.fromXmlPtr(childPtr);
}