# DiscoInfo.fromQuery constructor

DiscoInfo.fromQuery(

1. XMLNode query,
2. JID jid

)

## Implementation

    factory DiscoInfo.fromQuery(XMLNode query, JID jid) {
      final features = List<String>.empty(growable: true);
      final identities = List<Identity>.empty(growable: true);
      final extendedInfo = List<DataForm>.empty(growable: true);

      for (final element in query.children) {
        if (element.tag == 'feature') {
          features.add(element.attributes['var']! as String);
        } else if (element.tag == 'identity') {
          identities.add(
            Identity(
              category: element.attributes['category']! as String,
              type: element.attributes['type']! as String,
              name: element.attributes['name'] as String?,
            ),
          );
        } else if (element.tag == 'x' &&
            element.attributes['xmlns'] == dataFormsXmlns) {
          extendedInfo.add(
            parseDataForm(element),
          );
        }
      }

      return DiscoInfo(
        features,
        identities,
        extendedInfo,
        query.attributes['node'] as String?,
        jid,
      );
    }