toXmlElement method

XmlNode toXmlElement()

Implementation

XmlNode toXmlElement() {
  final attributes = <XmlAttribute>[];
  if (_alignWithMargins != null) {
    attributes.add(XmlAttribute(
        XmlName("alignWithMargins"), _alignWithMargins.toString()));
  }
  if (_differentFirst != null) {
    attributes.add(
        XmlAttribute(XmlName("differentFirst"), _differentFirst.toString()));
  }
  if (_differentOddEven != null) {
    attributes.add(XmlAttribute(
        XmlName("differentOddEven"), _differentOddEven.toString()));
  }
  if (_scaleWithDoc != null) {
    attributes
        .add(XmlAttribute(XmlName("scaleWithDoc"), _scaleWithDoc.toString()));
  }

  final children = <XmlNode>[];
  if (_evenFooter != null) {
    children
        .add(XmlElement(XmlName("evenFooter"), [], [XmlText(_evenFooter!)]));
  }
  if (_evenHeader != null) {
    children
        .add(XmlElement(XmlName("evenHeader"), [], [XmlText(_evenHeader!)]));
  }
  if (_firstFooter != null) {
    children.add(
        XmlElement(XmlName("firstFooter"), [], [XmlText(_firstFooter!)]));
  }
  if (_firstHeader != null) {
    children.add(
        XmlElement(XmlName("firstHeader"), [], [XmlText(_firstHeader!)]));
  }
  if (_oddFooter != null) {
    children
        .add(XmlElement(XmlName("oddFooter"), [], [XmlText(_oddFooter!)]));
  }
  if (_oddHeader != null) {
    children
        .add(XmlElement(XmlName("oddHeader"), [], [XmlText(_oddHeader!)]));
  }

  return XmlElement(XmlName("headerFooter"), attributes, children);
}