toXml method

XmlNode toXml()

Implementation

XmlNode toXml() {
  final builder = XmlBuilder();
  builder.element(
    'WebsiteConfiguration',
    nest: () {
      if (errorDocument != null) {
        builder.element(
          'ErrorDocument',
          nest: (errorDocument!.toXml() as XmlDocument).rootElement.children,
        );
      }

      if (indexDocument != null) {
        builder.element(
          'IndexDocument',
          nest: (indexDocument!.toXml() as XmlDocument).rootElement.children,
        );
      }

      if (redirectAllRequestsTo != null) {
        builder.element(
          'RedirectAllRequestsTo',
          nest: (redirectAllRequestsTo!.toXml() as XmlDocument)
              .rootElement
              .children,
        );
      }

      if (routingRules != null) {
        builder.element(
          'RoutingRules',
          nest: (routingRules!.toXml() as XmlDocument).rootElement.children,
        );
      }
    },
  );
  return builder.buildDocument();
}