toXml method

XMLNode toXml()

Implementation

XMLNode toXml() {
  return XMLNode.xmlns(
    tag: 'x',
    xmlns: dataFormsXmlns,
    attributes: {'type': type},
    children: [
      ...instructions.map((i) => XMLNode(tag: 'instruction', text: i)),
      ...title != null ? [XMLNode(tag: 'title', text: title)] : [],
      ...fields.map((field) => field.toXml()),
      ...reported.map((report) => report.toXml()),
      ...items.map(
        (item) => XMLNode(
          tag: 'item',
          children: item.map((i) => i.toXml()).toList(),
        ),
      ),
    ],
  );
}