parseDBusIntrospectXml function

DBusIntrospectNode parseDBusIntrospectXml(
  1. String xml
)

Parse D-Bus introspection data.

Implementation

DBusIntrospectNode parseDBusIntrospectXml(String xml) {
  XmlDocument document;
  try {
    document = XmlDocument.parse(xml);
  } on XmlParserException catch (e) {
    throw FormatException('D-Bus Introspection XML not valid: ${e.message}');
  }
  var nodeName = document.rootElement.name.local;
  if (nodeName != 'node') {
    throw FormatException(
        "D-Bus Introspection XML has invalid root element '$nodeName', expected 'node'");
  }
  return DBusIntrospectNode.fromXml(document.rootElement);
}