toXml method

XmlElement toXml(
  1. String elemName, {
  2. List<XmlAttribute>? attributes,
})

Implementation

_s.XmlElement toXml(String elemName, {List<_s.XmlAttribute>? attributes}) {
  final event = this.event;
  final events = this.events;
  final id = this.id;
  final topic = this.topic;
  final $children = <_s.XmlNode>[
    if (id != null) _s.encodeXmlStringValue('Id', id),
    if (events != null)
      ...events.map((e) => _s.encodeXmlStringValue('Event', e.toValue())),
    if (event != null) _s.encodeXmlStringValue('Event', event.toValue()),
    if (topic != null) _s.encodeXmlStringValue('Topic', topic),
  ];
  final $attributes = <_s.XmlAttribute>[
    ...?attributes,
  ];
  return _s.XmlElement(
    _s.XmlName(elemName),
    $attributes,
    $children,
  );
}