You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2023/02/08 18:20:36 UTC

[camel] branch main updated (7ee18e2f325 -> 701a15a2094)

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from 7ee18e2f325 CAMEL-18131 - camel-health - Do not register Producer Health Check until CAMEL-18992 will be completed - Translate
     new 4f30108127e [CAMEL-18305] Generate a lightweight xml writer
     new 701a15a2094 [CAMEL-18305] New lightweight ModelToXMLDumper

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel/model/CircuitBreakerDefinition.java      |    2 +-
 .../apache/camel/model/PropertyDefinitions.java    |    7 +-
 .../org/apache/camel/model/SagaDefinition.java     |    5 +
 .../camel/model/dataformat/BindyDataFormat.java    |   54 +-
 .../model/rest/ResponseMessageDefinition.java      |    2 +-
 core/camel-core/pom.xml                            |    4 +
 core/camel-xml-io/pom.xml                          |    2 +
 .../java/org/apache/camel/xml/in/ModelParser.java  |    4 +-
 .../java/org/apache/camel/xml/out/ModelWriter.java | 4973 ++++++++++++++++++++
 .../services/org/apache/camel/modelxml-dumper      |    2 +
 .../org/apache/camel/xml/LwModelToXMLDumper.java   |  268 ++
 .../java/org/apache/camel/xml/io/XMLWriter.java    |  328 ++
 .../java/org/apache/camel/xml/out/BaseWriter.java  |   54 +
 .../org/apache/camel/xml/out/ModelWriterTest.java  |  224 +
 .../dsl/yaml/deserializers/ModelDeserializers.java |    2 +-
 .../packaging/ModelXmlWriterGeneratorMojo.java     |  849 ++++
 16 files changed, 6741 insertions(+), 39 deletions(-)
 create mode 100644 core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
 create mode 100644 core/camel-xml-io/src/generated/resources/META-INF/services/org/apache/camel/modelxml-dumper
 create mode 100644 core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java
 create mode 100644 core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java
 create mode 100644 core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java
 create mode 100644 core/camel-xml-io/src/test/java/org/apache/camel/xml/out/ModelWriterTest.java
 create mode 100644 tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java


[camel] 01/02: [CAMEL-18305] Generate a lightweight xml writer

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 4f30108127e1abe5380c12d01410ac5be86d11f2
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Feb 3 09:34:49 2023 +0100

    [CAMEL-18305] Generate a lightweight xml writer
    
    First step to have a lighweight xml dumper is to provide a model writer
---
 .../camel/model/CircuitBreakerDefinition.java      |    2 +-
 .../apache/camel/model/PropertyDefinitions.java    |    7 +-
 .../org/apache/camel/model/SagaDefinition.java     |    5 +
 .../camel/model/dataformat/BindyDataFormat.java    |   54 +-
 .../model/rest/ResponseMessageDefinition.java      |    2 +-
 core/camel-xml-io/pom.xml                          |    2 +
 .../java/org/apache/camel/xml/in/ModelParser.java  |    4 +-
 .../java/org/apache/camel/xml/out/ModelWriter.java | 4944 ++++++++++++++++++++
 .../java/org/apache/camel/xml/io/XMLWriter.java    |  353 ++
 .../java/org/apache/camel/xml/out/BaseWriter.java  |   54 +
 .../org/apache/camel/xml/out/ModelWriterTest.java  |  224 +
 .../dsl/yaml/deserializers/ModelDeserializers.java |    2 +-
 .../packaging/ModelXmlWriterGeneratorMojo.java     |  834 ++++
 13 files changed, 6448 insertions(+), 39 deletions(-)

diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java
index c7f1b338f22..b7de31616c8 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/CircuitBreakerDefinition.java
@@ -113,7 +113,7 @@ public class CircuitBreakerDefinition extends OutputDefinition<CircuitBreakerDef
         }
     }
 
-    public Resilience4jConfigurationCommon getResilience4jConfiguration() {
+    public Resilience4jConfigurationDefinition getResilience4jConfiguration() {
         return resilience4jConfiguration;
     }
 
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/PropertyDefinitions.java b/core/camel-core-model/src/main/java/org/apache/camel/model/PropertyDefinitions.java
index e1df75ff17b..ed6ef30b2af 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/PropertyDefinitions.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/PropertyDefinitions.java
@@ -19,17 +19,18 @@ package org.apache.camel.model;
 import java.util.ArrayList;
 import java.util.List;
 
+import jakarta.xml.bind.annotation.XmlAccessType;
+import jakarta.xml.bind.annotation.XmlAccessorType;
 import jakarta.xml.bind.annotation.XmlElement;
-import jakarta.xml.bind.annotation.XmlTransient;
 import jakarta.xml.bind.annotation.XmlType;
 
 @XmlType
+@XmlAccessorType(XmlAccessType.FIELD)
 public class PropertyDefinitions {
 
-    @XmlTransient
+    @XmlElement(name = "property")
     private List<PropertyDefinition> properties = new ArrayList<>();
 
-    @XmlElement(name = "property")
     public List<PropertyDefinition> getProperties() {
         return properties;
     }
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/SagaDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/SagaDefinition.java
index 425d9785551..0a4c07d3698 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/SagaDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/SagaDefinition.java
@@ -70,6 +70,11 @@ public class SagaDefinition extends OutputDefinition<SagaDefinition> {
     public SagaDefinition() {
     }
 
+    @Override
+    public List<ProcessorDefinition<?>> getOutputs() {
+        return outputs;
+    }
+
     @XmlElementRef
     @Override
     public void setOutputs(List<ProcessorDefinition<?>> outputs) {
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
index 213ae4959b1..5d540686d69 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/dataformat/BindyDataFormat.java
@@ -34,17 +34,16 @@ import org.apache.camel.spi.Metadata;
  */
 @Metadata(firstVersion = "2.0.0", label = "dataformat,transformation,csv", title = "Bindy")
 @XmlRootElement(name = "bindy")
-@XmlAccessorType(XmlAccessType.FIELD)
+@XmlAccessorType(XmlAccessType.NONE)
 public class BindyDataFormat extends DataFormatDefinition {
 
-    @XmlTransient
-    private Class<?> clazz;
+    private Class<?> classType;
 
     @XmlAttribute(required = true)
     @Metadata(required = true, javaType = "org.apache.camel.model.dataformat.BindyType", enums = "Csv,Fixed,KeyValue")
     private String type;
-    @XmlAttribute
-    private String classType;
+    @XmlAttribute(name = "classType")
+    private String classTypeAsString;
     @XmlAttribute
     @Metadata(javaType = "java.lang.Boolean", defaultValue = "false")
     private String allowEmptyStream;
@@ -61,9 +60,9 @@ public class BindyDataFormat extends DataFormatDefinition {
 
     private BindyDataFormat(Builder builder) {
         this();
-        this.clazz = builder.clazz;
-        this.type = builder.type;
         this.classType = builder.classType;
+        this.type = builder.type;
+        this.classTypeAsString = builder.classTypeAsString;
         this.allowEmptyStream = builder.allowEmptyStream;
         this.unwrapSingleInstance = builder.unwrapSingleInstance;
         this.locale = builder.locale;
@@ -81,7 +80,14 @@ public class BindyDataFormat extends DataFormatDefinition {
     }
 
     public String getClassTypeAsString() {
-        return classType;
+        return classTypeAsString;
+    }
+
+    /**
+     * Name of model class to use.
+     */
+    public void setClassTypeAsString(String classType) {
+        this.classTypeAsString = classType;
     }
 
     @Override
@@ -95,29 +101,15 @@ public class BindyDataFormat extends DataFormatDefinition {
         }
     }
 
-    /**
-     * Name of model class to use.
-     */
-    public void setClassTypeAsString(String classType) {
-        this.classType = classType;
-    }
-
-    /**
-     * Name of model class to use.
-     */
-    public void setClassType(String classType) {
-        setClassTypeAsString(classType);
-    }
-
     /**
      * Name of model class to use.
      */
     public void setClassType(Class<?> classType) {
-        this.clazz = classType;
+        this.classType = classType;
     }
 
     public Class<?> getClassType() {
-        return clazz;
+        return classType;
     }
 
     public String getLocale() {
@@ -183,12 +175,12 @@ public class BindyDataFormat extends DataFormatDefinition {
     }
 
     public BindyDataFormat classType(Class<?> classType) {
-        this.clazz = classType;
+        this.classType = classType;
         return this;
     }
 
     public BindyDataFormat classType(String classType) {
-        this.classType = classType;
+        this.classTypeAsString = classType;
         return this;
     }
 
@@ -226,9 +218,9 @@ public class BindyDataFormat extends DataFormatDefinition {
     @XmlTransient
     public static class Builder implements DataFormatBuilder<BindyDataFormat> {
 
-        private Class<?> clazz;
+        private Class<?> classType;
         private String type;
-        private String classType;
+        private String classTypeAsString;
         private String allowEmptyStream;
         private String unwrapSingleInstance;
         private String locale;
@@ -248,8 +240,8 @@ public class BindyDataFormat extends DataFormatDefinition {
         /**
          * Name of model class to use.
          */
-        public Builder classType(String classType) {
-            this.classType = classType;
+        public Builder classType(String classTypeAsString) {
+            this.classTypeAsString = classTypeAsString;
             return this;
         }
 
@@ -257,7 +249,7 @@ public class BindyDataFormat extends DataFormatDefinition {
          * Name of model class to use.
          */
         public Builder classType(Class<?> classType) {
-            this.clazz = classType;
+            this.classType = classType;
             return this;
         }
 
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/ResponseMessageDefinition.java b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/ResponseMessageDefinition.java
index 8666c64fd2f..244c8d2a0a8 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/rest/ResponseMessageDefinition.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/rest/ResponseMessageDefinition.java
@@ -71,7 +71,7 @@ public class ResponseMessageDefinition {
     }
 
     public String getResponseModel() {
-        return responseModel != null ? responseModel : "";
+        return responseModel;
     }
 
     public void setResponseModel(String responseModel) {
diff --git a/core/camel-xml-io/pom.xml b/core/camel-xml-io/pom.xml
index cc05b6c433c..6a29601d2a6 100644
--- a/core/camel-xml-io/pom.xml
+++ b/core/camel-xml-io/pom.xml
@@ -34,6 +34,7 @@
         <firstVersion>3.1.0</firstVersion>
         <label>dsl</label>
         <camel-generate-xml-parser>true</camel-generate-xml-parser>
+        <camel-generate-xml-writer>true</camel-generate-xml-writer>
     </properties>
 
     <dependencies>
@@ -66,6 +67,7 @@
                         <phase>generate-sources</phase>
                         <goals>
                             <goal>generate-xml-parser</goal>
+                            <goal>generate-xml-writer</goal>
                         </goals>
                     </execution>
                 </executions>
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
index c9ee653d863..6fc5c8fa1e5 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/in/ModelParser.java
@@ -779,7 +779,7 @@ public class ModelParser extends BaseParser {
     protected PropertyDefinitions doParsePropertyDefinitions() throws IOException, XmlPullParserException {
         return doParse(new PropertyDefinitions(),
             noAttributeHandler(), (def, key) -> {
-            if ("properties".equals(key)) {
+            if ("property".equals(key)) {
                 doAdd(doParsePropertyDefinition(), def.getProperties(), def::setProperties);
                 return true;
             }
@@ -1933,7 +1933,7 @@ public class ModelParser extends BaseParser {
         return doParse(new BindyDataFormat(), (def, key, val) -> {
             switch (key) {
                 case "allowEmptyStream": def.setAllowEmptyStream(val); break;
-                case "classType": def.setClassType(val); break;
+                case "classType": def.setClassTypeAsString(val); break;
                 case "locale": def.setLocale(val); break;
                 case "type": def.setType(val); break;
                 case "unwrapSingleInstance": def.setUnwrapSingleInstance(val); break;
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
new file mode 100644
index 00000000000..3f89b8b860e
--- /dev/null
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -0,0 +1,4944 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//CHECKSTYLE:OFF
+
+
+/**
+ * Generated by Camel build tools - do NOT edit this file!
+ */
+package org.apache.camel.xml.out;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
+import org.apache.camel.model.*;
+import org.apache.camel.model.cloud.*;
+import org.apache.camel.model.config.BatchResequencerConfig;
+import org.apache.camel.model.config.ResequencerConfig;
+import org.apache.camel.model.config.StreamResequencerConfig;
+import org.apache.camel.model.dataformat.*;
+import org.apache.camel.model.errorhandler.*;
+import org.apache.camel.model.language.*;
+import org.apache.camel.model.loadbalancer.*;
+import org.apache.camel.model.rest.*;
+import org.apache.camel.model.transformer.*;
+import org.apache.camel.model.validator.*;
+
+@SuppressWarnings("all")
+public class ModelWriter extends BaseWriter {
+
+    public ModelWriter(Writer writer, String namespace) throws IOException {
+        super(writer, namespace);
+    }
+    public ModelWriter(Writer writer) throws IOException {
+        super(writer, null);
+    }
+    public void writeAggregateDefinition(
+            AggregateDefinition def)
+            throws IOException {
+        doWriteAggregateDefinition("aggregate", def);
+    }
+    public void writeBeanDefinition(BeanDefinition def) throws IOException {
+        doWriteBeanDefinition("bean", def);
+    }
+    public void writeCatchDefinition(CatchDefinition def) throws IOException {
+        doWriteCatchDefinition("doCatch", def);
+    }
+    public void writeChoiceDefinition(ChoiceDefinition def) throws IOException {
+        doWriteChoiceDefinition("choice", def);
+    }
+    public void writeCircuitBreakerDefinition(
+            CircuitBreakerDefinition def)
+            throws IOException {
+        doWriteCircuitBreakerDefinition("circuitBreaker", def);
+    }
+    public void writeClaimCheckDefinition(
+            ClaimCheckDefinition def)
+            throws IOException {
+        doWriteClaimCheckDefinition("claimCheck", def);
+    }
+    public void writeContextScanDefinition(
+            ContextScanDefinition def)
+            throws IOException {
+        doWriteContextScanDefinition("contextScan", def);
+    }
+    public void writeConvertBodyDefinition(
+            ConvertBodyDefinition def)
+            throws IOException {
+        doWriteConvertBodyDefinition("convertBodyTo", def);
+    }
+    public void writeDelayDefinition(DelayDefinition def) throws IOException {
+        doWriteDelayDefinition("delay", def);
+    }
+    public void writeDescriptionDefinition(
+            DescriptionDefinition def)
+            throws IOException {
+        doWriteDescriptionDefinition("description", def);
+    }
+    public void writeDynamicRouterDefinition(
+            DynamicRouterDefinition def)
+            throws IOException {
+        doWriteDynamicRouterDefinition("dynamicRouter", def);
+    }
+    public void writeEnrichDefinition(EnrichDefinition def) throws IOException {
+        doWriteEnrichDefinition("enrich", def);
+    }
+    public void writeErrorHandlerDefinition(
+            ErrorHandlerDefinition def)
+            throws IOException {
+        doWriteErrorHandlerDefinition("errorHandler", def);
+    }
+    public void writeExpressionSubElementDefinition(
+            ExpressionSubElementDefinition def)
+            throws IOException {
+        doWriteExpressionSubElementDefinition("expression", def);
+    }
+    public void writeFaultToleranceConfigurationDefinition(
+            FaultToleranceConfigurationDefinition def)
+            throws IOException {
+        doWriteFaultToleranceConfigurationDefinition("faultToleranceConfiguration", def);
+    }
+    public void writeFilterDefinition(FilterDefinition def) throws IOException {
+        doWriteFilterDefinition("filter", def);
+    }
+    public void writeFinallyDefinition(FinallyDefinition def) throws IOException {
+        doWriteFinallyDefinition("doFinally", def);
+    }
+    public void writeFromDefinition(FromDefinition def) throws IOException {
+        doWriteFromDefinition("from", def);
+    }
+    public void writeGlobalOptionDefinition(
+            GlobalOptionDefinition def)
+            throws IOException {
+        doWriteGlobalOptionDefinition("globalOption", def);
+    }
+    public void writeGlobalOptionsDefinition(
+            GlobalOptionsDefinition def)
+            throws IOException {
+        doWriteGlobalOptionsDefinition("globalOptions", def);
+    }
+    public void writeIdempotentConsumerDefinition(
+            IdempotentConsumerDefinition def)
+            throws IOException {
+        doWriteIdempotentConsumerDefinition("idempotentConsumer", def);
+    }
+    public void writeInOnlyDefinition(InOnlyDefinition def) throws IOException {
+        doWriteInOnlyDefinition("inOnly", def);
+    }
+    public void writeInOutDefinition(InOutDefinition def) throws IOException {
+        doWriteInOutDefinition("inOut", def);
+    }
+    public void writeInputTypeDefinition(
+            InputTypeDefinition def)
+            throws IOException {
+        doWriteInputTypeDefinition("inputType", def);
+    }
+    public void writeInterceptDefinition(
+            InterceptDefinition def)
+            throws IOException {
+        doWriteInterceptDefinition("intercept", def);
+    }
+    public void writeInterceptFromDefinition(
+            InterceptFromDefinition def)
+            throws IOException {
+        doWriteInterceptFromDefinition("interceptFrom", def);
+    }
+    public void writeInterceptSendToEndpointDefinition(
+            InterceptSendToEndpointDefinition def)
+            throws IOException {
+        doWriteInterceptSendToEndpointDefinition("interceptSendToEndpoint", def);
+    }
+    public void writeKameletDefinition(KameletDefinition def) throws IOException {
+        doWriteKameletDefinition("kamelet", def);
+    }
+    public void writeLoadBalanceDefinition(
+            LoadBalanceDefinition def)
+            throws IOException {
+        doWriteLoadBalanceDefinition("loadBalance", def);
+    }
+    public void writeLogDefinition(LogDefinition def) throws IOException {
+        doWriteLogDefinition("log", def);
+    }
+    public void writeLoopDefinition(LoopDefinition def) throws IOException {
+        doWriteLoopDefinition("loop", def);
+    }
+    public void writeMarshalDefinition(MarshalDefinition def) throws IOException {
+        doWriteMarshalDefinition("marshal", def);
+    }
+    public void writeMulticastDefinition(
+            MulticastDefinition def)
+            throws IOException {
+        doWriteMulticastDefinition("multicast", def);
+    }
+    public void writeOnCompletionDefinition(
+            OnCompletionDefinition def)
+            throws IOException {
+        doWriteOnCompletionDefinition("onCompletion", def);
+    }
+    public void writeOnExceptionDefinition(
+            OnExceptionDefinition def)
+            throws IOException {
+        doWriteOnExceptionDefinition("onException", def);
+    }
+    public void writeOnFallbackDefinition(
+            OnFallbackDefinition def)
+            throws IOException {
+        doWriteOnFallbackDefinition("onFallback", def);
+    }
+    public void writeOptimisticLockRetryPolicyDefinition(
+            OptimisticLockRetryPolicyDefinition def)
+            throws IOException {
+        doWriteOptimisticLockRetryPolicyDefinition("optimisticLockRetryPolicy", def);
+    }
+    public void writeOtherwiseDefinition(
+            OtherwiseDefinition def)
+            throws IOException {
+        doWriteOtherwiseDefinition("otherwise", def);
+    }
+    public void writeOutputTypeDefinition(
+            OutputTypeDefinition def)
+            throws IOException {
+        doWriteOutputTypeDefinition("outputType", def);
+    }
+    public void writePackageScanDefinition(
+            PackageScanDefinition def)
+            throws IOException {
+        doWritePackageScanDefinition("packageScan", def);
+    }
+    public void writePausableDefinition(
+            PausableDefinition def)
+            throws IOException {
+        doWritePausableDefinition("pausable", def);
+    }
+    public void writePipelineDefinition(
+            PipelineDefinition def)
+            throws IOException {
+        doWritePipelineDefinition("pipeline", def);
+    }
+    public void writePolicyDefinition(PolicyDefinition def) throws IOException {
+        doWritePolicyDefinition("policy", def);
+    }
+    public void writePollEnrichDefinition(
+            PollEnrichDefinition def)
+            throws IOException {
+        doWritePollEnrichDefinition("pollEnrich", def);
+    }
+    public void writeProcessDefinition(ProcessDefinition def) throws IOException {
+        doWriteProcessDefinition("process", def);
+    }
+    public void writePropertyDefinition(
+            PropertyDefinition def)
+            throws IOException {
+        doWritePropertyDefinition("property", def);
+    }
+    public void writePropertyExpressionDefinition(
+            PropertyExpressionDefinition def)
+            throws IOException {
+        doWritePropertyExpressionDefinition("propertyExpression", def);
+    }
+    public void writeRecipientListDefinition(
+            RecipientListDefinition def)
+            throws IOException {
+        doWriteRecipientListDefinition("recipientList", def);
+    }
+    public void writeRedeliveryPolicyDefinition(
+            RedeliveryPolicyDefinition def)
+            throws IOException {
+        doWriteRedeliveryPolicyDefinition("redeliveryPolicy", def);
+    }
+    public void writeRemoveHeaderDefinition(
+            RemoveHeaderDefinition def)
+            throws IOException {
+        doWriteRemoveHeaderDefinition("removeHeader", def);
+    }
+    public void writeRemoveHeadersDefinition(
+            RemoveHeadersDefinition def)
+            throws IOException {
+        doWriteRemoveHeadersDefinition("removeHeaders", def);
+    }
+    public void writeRemovePropertiesDefinition(
+            RemovePropertiesDefinition def)
+            throws IOException {
+        doWriteRemovePropertiesDefinition("removeProperties", def);
+    }
+    public void writeRemovePropertyDefinition(
+            RemovePropertyDefinition def)
+            throws IOException {
+        doWriteRemovePropertyDefinition("removeProperty", def);
+    }
+    public void writeResequenceDefinition(
+            ResequenceDefinition def)
+            throws IOException {
+        doWriteResequenceDefinition("resequence", def);
+    }
+    public void writeResilience4jConfigurationDefinition(
+            Resilience4jConfigurationDefinition def)
+            throws IOException {
+        doWriteResilience4jConfigurationDefinition("resilience4jConfiguration", def);
+    }
+    public void writeRestContextRefDefinition(
+            RestContextRefDefinition def)
+            throws IOException {
+        doWriteRestContextRefDefinition("restContextRef", def);
+    }
+    public void writeResumableDefinition(
+            ResumableDefinition def)
+            throws IOException {
+        doWriteResumableDefinition("resumable", def);
+    }
+    public void writeRollbackDefinition(
+            RollbackDefinition def)
+            throws IOException {
+        doWriteRollbackDefinition("rollback", def);
+    }
+    public void writeRouteBuilderDefinition(
+            RouteBuilderDefinition def)
+            throws IOException {
+        doWriteRouteBuilderDefinition("routeBuilder", def);
+    }
+    public void writeRouteConfigurationContextRefDefinition(
+            RouteConfigurationContextRefDefinition def)
+            throws IOException {
+        doWriteRouteConfigurationContextRefDefinition("routeConfigurationContextRef", def);
+    }
+    public void writeRouteConfigurationDefinition(
+            RouteConfigurationDefinition def)
+            throws IOException {
+        doWriteRouteConfigurationDefinition("routeConfiguration", def);
+    }
+    public void writeRouteConfigurationsDefinition(
+            RouteConfigurationsDefinition def)
+            throws IOException {
+        doWriteRouteConfigurationsDefinition("routeConfigurations", def);
+    }
+    public void writeRouteContextRefDefinition(
+            RouteContextRefDefinition def)
+            throws IOException {
+        doWriteRouteContextRefDefinition("routeContextRef", def);
+    }
+    public void writeRouteDefinition(RouteDefinition def) throws IOException {
+        doWriteRouteDefinition("route", def);
+    }
+    public void writeRouteTemplateBeanDefinition(
+            RouteTemplateBeanDefinition def)
+            throws IOException {
+        doWriteRouteTemplateBeanDefinition("templateBean", def);
+    }
+    public void writeRouteTemplateContextRefDefinition(
+            RouteTemplateContextRefDefinition def)
+            throws IOException {
+        doWriteRouteTemplateContextRefDefinition("routeTemplateContextRef", def);
+    }
+    public void writeRouteTemplateDefinition(
+            RouteTemplateDefinition def)
+            throws IOException {
+        doWriteRouteTemplateDefinition("routeTemplate", def);
+    }
+    public void writeRouteTemplateParameterDefinition(
+            RouteTemplateParameterDefinition def)
+            throws IOException {
+        doWriteRouteTemplateParameterDefinition("templateParameter", def);
+    }
+    public void writeRouteTemplatesDefinition(
+            RouteTemplatesDefinition def)
+            throws IOException {
+        doWriteRouteTemplatesDefinition("routeTemplates", def);
+    }
+    public void writeRoutesDefinition(RoutesDefinition def) throws IOException {
+        doWriteRoutesDefinition("routes", def);
+    }
+    public void writeRoutingSlipDefinition(
+            RoutingSlipDefinition def)
+            throws IOException {
+        doWriteRoutingSlipDefinition("routingSlip", def);
+    }
+    public void writeSagaDefinition(SagaDefinition def) throws IOException {
+        doWriteSagaDefinition("saga", def);
+    }
+    public void writeSamplingDefinition(
+            SamplingDefinition def)
+            throws IOException {
+        doWriteSamplingDefinition("sample", def);
+    }
+    public void writeScriptDefinition(ScriptDefinition def) throws IOException {
+        doWriteScriptDefinition("script", def);
+    }
+    public void writeSetBodyDefinition(SetBodyDefinition def) throws IOException {
+        doWriteSetBodyDefinition("setBody", def);
+    }
+    public void writeSetExchangePatternDefinition(
+            SetExchangePatternDefinition def)
+            throws IOException {
+        doWriteSetExchangePatternDefinition("setExchangePattern", def);
+    }
+    public void writeSetHeaderDefinition(
+            SetHeaderDefinition def)
+            throws IOException {
+        doWriteSetHeaderDefinition("setHeader", def);
+    }
+    public void writeSetPropertyDefinition(
+            SetPropertyDefinition def)
+            throws IOException {
+        doWriteSetPropertyDefinition("setProperty", def);
+    }
+    public void writeSortDefinition(SortDefinition def) throws IOException {
+        doWriteSortDefinition("sort", def);
+    }
+    public void writeSplitDefinition(SplitDefinition def) throws IOException {
+        doWriteSplitDefinition("split", def);
+    }
+    public void writeStepDefinition(StepDefinition def) throws IOException {
+        doWriteStepDefinition("step", def);
+    }
+    public void writeStopDefinition(StopDefinition def) throws IOException {
+        doWriteStopDefinition("stop", def);
+    }
+    public void writeTemplatedRouteBeanDefinition(
+            TemplatedRouteBeanDefinition def)
+            throws IOException {
+        doWriteTemplatedRouteBeanDefinition("templatedRouteBean", def);
+    }
+    public void writeTemplatedRouteDefinition(
+            TemplatedRouteDefinition def)
+            throws IOException {
+        doWriteTemplatedRouteDefinition("templatedRoute", def);
+    }
+    public void writeTemplatedRouteParameterDefinition(
+            TemplatedRouteParameterDefinition def)
+            throws IOException {
+        doWriteTemplatedRouteParameterDefinition("templatedRouteParameter", def);
+    }
+    public void writeTemplatedRoutesDefinition(
+            TemplatedRoutesDefinition def)
+            throws IOException {
+        doWriteTemplatedRoutesDefinition("templatedRoutes", def);
+    }
+    public void writeThreadPoolProfileDefinition(
+            ThreadPoolProfileDefinition def)
+            throws IOException {
+        doWriteThreadPoolProfileDefinition("threadPoolProfile", def);
+    }
+    public void writeThreadsDefinition(ThreadsDefinition def) throws IOException {
+        doWriteThreadsDefinition("threads", def);
+    }
+    public void writeThrottleDefinition(
+            ThrottleDefinition def)
+            throws IOException {
+        doWriteThrottleDefinition("throttle", def);
+    }
+    public void writeThrowExceptionDefinition(
+            ThrowExceptionDefinition def)
+            throws IOException {
+        doWriteThrowExceptionDefinition("throwException", def);
+    }
+    public void writeToDefinition(ToDefinition def) throws IOException {
+        doWriteToDefinition("to", def);
+    }
+    public void writeToDynamicDefinition(
+            ToDynamicDefinition def)
+            throws IOException {
+        doWriteToDynamicDefinition("toD", def);
+    }
+    public void writeTransactedDefinition(
+            TransactedDefinition def)
+            throws IOException {
+        doWriteTransactedDefinition("transacted", def);
+    }
+    public void writeTransformDefinition(
+            TransformDefinition def)
+            throws IOException {
+        doWriteTransformDefinition("transform", def);
+    }
+    public void writeTryDefinition(TryDefinition def) throws IOException {
+        doWriteTryDefinition("doTry", def);
+    }
+    public void writeUnmarshalDefinition(
+            UnmarshalDefinition def)
+            throws IOException {
+        doWriteUnmarshalDefinition("unmarshal", def);
+    }
+    public void writeValidateDefinition(
+            ValidateDefinition def)
+            throws IOException {
+        doWriteValidateDefinition("validate", def);
+    }
+    public void writeValueDefinition(ValueDefinition def) throws IOException {
+        doWriteValueDefinition("value", def);
+    }
+    public void writeWhenDefinition(WhenDefinition def) throws IOException {
+        doWriteWhenDefinition("when", def);
+    }
+    public void writeWireTapDefinition(WireTapDefinition def) throws IOException {
+        doWriteWireTapDefinition("wireTap", def);
+    }
+    public void writeBlacklistServiceCallServiceFilterConfiguration(
+            BlacklistServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWriteBlacklistServiceCallServiceFilterConfiguration("blacklistServiceFilter", def);
+    }
+    public void writeCachingServiceCallServiceDiscoveryConfiguration(
+            CachingServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteCachingServiceCallServiceDiscoveryConfiguration("cachingServiceDiscovery", def);
+    }
+    public void writeCombinedServiceCallServiceDiscoveryConfiguration(
+            CombinedServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteCombinedServiceCallServiceDiscoveryConfiguration("combinedServiceDiscovery", def);
+    }
+    public void writeCombinedServiceCallServiceFilterConfiguration(
+            CombinedServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWriteCombinedServiceCallServiceFilterConfiguration("combinedServiceFilter", def);
+    }
+    public void writeConsulServiceCallServiceDiscoveryConfiguration(
+            ConsulServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteConsulServiceCallServiceDiscoveryConfiguration("consulServiceDiscovery", def);
+    }
+    public void writeCustomServiceCallServiceFilterConfiguration(
+            CustomServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWriteCustomServiceCallServiceFilterConfiguration("customServiceFilter", def);
+    }
+    public void writeDefaultServiceCallServiceLoadBalancerConfiguration(
+            DefaultServiceCallServiceLoadBalancerConfiguration def)
+            throws IOException {
+        doWriteDefaultServiceCallServiceLoadBalancerConfiguration("defaultLoadBalancer", def);
+    }
+    public void writeDnsServiceCallServiceDiscoveryConfiguration(
+            DnsServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteDnsServiceCallServiceDiscoveryConfiguration("dnsServiceDiscovery", def);
+    }
+    public void writeHealthyServiceCallServiceFilterConfiguration(
+            HealthyServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWriteHealthyServiceCallServiceFilterConfiguration("healthyServiceFilter", def);
+    }
+    public void writeKubernetesServiceCallServiceDiscoveryConfiguration(
+            KubernetesServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteKubernetesServiceCallServiceDiscoveryConfiguration("kubernetesServiceDiscovery", def);
+    }
+    public void writePassThroughServiceCallServiceFilterConfiguration(
+            PassThroughServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWritePassThroughServiceCallServiceFilterConfiguration("passThroughServiceFilter", def);
+    }
+    public void writeServiceCallConfigurationDefinition(
+            ServiceCallConfigurationDefinition def)
+            throws IOException {
+        doWriteServiceCallConfigurationDefinition("serviceCallConfiguration", def);
+    }
+    public void writeServiceCallDefinition(
+            ServiceCallDefinition def)
+            throws IOException {
+        doWriteServiceCallDefinition("serviceCall", def);
+    }
+    public void writeServiceCallExpressionConfiguration(
+            ServiceCallExpressionConfiguration def)
+            throws IOException {
+        doWriteServiceCallExpressionConfiguration("serviceExpression", def);
+    }
+    public void writeServiceCallServiceChooserConfiguration(
+            ServiceCallServiceChooserConfiguration def)
+            throws IOException {
+        doWriteServiceCallServiceChooserConfiguration("serviceChooserConfiguration", def);
+    }
+    public void writeServiceCallServiceDiscoveryConfiguration(
+            ServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteServiceCallServiceDiscoveryConfiguration("serviceDiscoveryConfiguration", def);
+    }
+    public void writeServiceCallServiceFilterConfiguration(
+            ServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWriteServiceCallServiceFilterConfiguration("serviceFilterConfiguration", def);
+    }
+    public void writeServiceCallServiceLoadBalancerConfiguration(
+            ServiceCallServiceLoadBalancerConfiguration def)
+            throws IOException {
+        doWriteServiceCallServiceLoadBalancerConfiguration("loadBalancerConfiguration", def);
+    }
+    public void writeStaticServiceCallServiceDiscoveryConfiguration(
+            StaticServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteStaticServiceCallServiceDiscoveryConfiguration("staticServiceDiscovery", def);
+    }
+    public void writeZooKeeperServiceCallServiceDiscoveryConfiguration(
+            ZooKeeperServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteZooKeeperServiceCallServiceDiscoveryConfiguration("zookeeperServiceDiscovery", def);
+    }
+    public void writeBatchResequencerConfig(
+            BatchResequencerConfig def)
+            throws IOException {
+        doWriteBatchResequencerConfig("batch-config", def);
+    }
+    public void writeStreamResequencerConfig(
+            StreamResequencerConfig def)
+            throws IOException {
+        doWriteStreamResequencerConfig("stream-config", def);
+    }
+    public void writeASN1DataFormat(ASN1DataFormat def) throws IOException {
+        doWriteASN1DataFormat("asn1", def);
+    }
+    public void writeAvroDataFormat(AvroDataFormat def) throws IOException {
+        doWriteAvroDataFormat("avro", def);
+    }
+    public void writeBarcodeDataFormat(BarcodeDataFormat def) throws IOException {
+        doWriteBarcodeDataFormat("barcode", def);
+    }
+    public void writeBase64DataFormat(Base64DataFormat def) throws IOException {
+        doWriteBase64DataFormat("base64", def);
+    }
+    public void writeBindyDataFormat(BindyDataFormat def) throws IOException {
+        doWriteBindyDataFormat("bindy", def);
+    }
+    public void writeCBORDataFormat(CBORDataFormat def) throws IOException {
+        doWriteCBORDataFormat("cbor", def);
+    }
+    public void writeCryptoDataFormat(CryptoDataFormat def) throws IOException {
+        doWriteCryptoDataFormat("crypto", def);
+    }
+    public void writeCsvDataFormat(CsvDataFormat def) throws IOException {
+        doWriteCsvDataFormat("csv", def);
+    }
+    public void writeCustomDataFormat(CustomDataFormat def) throws IOException {
+        doWriteCustomDataFormat("custom", def);
+    }
+    public void writeDataFormatsDefinition(
+            DataFormatsDefinition def)
+            throws IOException {
+        doWriteDataFormatsDefinition("dataFormats", def);
+    }
+    public void writeFhirJsonDataFormat(
+            FhirJsonDataFormat def)
+            throws IOException {
+        doWriteFhirJsonDataFormat("fhirJson", def);
+    }
+    public void writeFhirXmlDataFormat(FhirXmlDataFormat def) throws IOException {
+        doWriteFhirXmlDataFormat("fhirXml", def);
+    }
+    public void writeFlatpackDataFormat(
+            FlatpackDataFormat def)
+            throws IOException {
+        doWriteFlatpackDataFormat("flatpack", def);
+    }
+    public void writeGrokDataFormat(GrokDataFormat def) throws IOException {
+        doWriteGrokDataFormat("grok", def);
+    }
+    public void writeGzipDeflaterDataFormat(
+            GzipDeflaterDataFormat def)
+            throws IOException {
+        doWriteGzipDeflaterDataFormat("gzipDeflater", def);
+    }
+    public void writeHL7DataFormat(HL7DataFormat def) throws IOException {
+        doWriteHL7DataFormat("hl7", def);
+    }
+    public void writeIcalDataFormat(IcalDataFormat def) throws IOException {
+        doWriteIcalDataFormat("ical", def);
+    }
+    public void writeJacksonXMLDataFormat(
+            JacksonXMLDataFormat def)
+            throws IOException {
+        doWriteJacksonXMLDataFormat("jacksonXml", def);
+    }
+    public void writeJaxbDataFormat(JaxbDataFormat def) throws IOException {
+        doWriteJaxbDataFormat("jaxb", def);
+    }
+    public void writeJsonApiDataFormat(JsonApiDataFormat def) throws IOException {
+        doWriteJsonApiDataFormat("jsonApi", def);
+    }
+    public void writeJsonDataFormat(JsonDataFormat def) throws IOException {
+        doWriteJsonDataFormat("json", def);
+    }
+    public void writeLZFDataFormat(LZFDataFormat def) throws IOException {
+        doWriteLZFDataFormat("lzf", def);
+    }
+    public void writeMimeMultipartDataFormat(
+            MimeMultipartDataFormat def)
+            throws IOException {
+        doWriteMimeMultipartDataFormat("mimeMultipart", def);
+    }
+    public void writePGPDataFormat(PGPDataFormat def) throws IOException {
+        doWritePGPDataFormat("pgp", def);
+    }
+    public void writeProtobufDataFormat(
+            ProtobufDataFormat def)
+            throws IOException {
+        doWriteProtobufDataFormat("protobuf", def);
+    }
+    public void writeRssDataFormat(RssDataFormat def) throws IOException {
+        doWriteRssDataFormat("rss", def);
+    }
+    public void writeSoapDataFormat(SoapDataFormat def) throws IOException {
+        doWriteSoapDataFormat("soap", def);
+    }
+    public void writeSwiftMtDataFormat(SwiftMtDataFormat def) throws IOException {
+        doWriteSwiftMtDataFormat("swiftMt", def);
+    }
+    public void writeSwiftMxDataFormat(SwiftMxDataFormat def) throws IOException {
+        doWriteSwiftMxDataFormat("swiftMx", def);
+    }
+    public void writeSyslogDataFormat(SyslogDataFormat def) throws IOException {
+        doWriteSyslogDataFormat("syslog", def);
+    }
+    public void writeTarFileDataFormat(TarFileDataFormat def) throws IOException {
+        doWriteTarFileDataFormat("tarFile", def);
+    }
+    public void writeThriftDataFormat(ThriftDataFormat def) throws IOException {
+        doWriteThriftDataFormat("thrift", def);
+    }
+    public void writeTidyMarkupDataFormat(
+            TidyMarkupDataFormat def)
+            throws IOException {
+        doWriteTidyMarkupDataFormat("tidyMarkup", def);
+    }
+    public void writeUniVocityCsvDataFormat(
+            UniVocityCsvDataFormat def)
+            throws IOException {
+        doWriteUniVocityCsvDataFormat("univocityCsv", def);
+    }
+    public void writeUniVocityFixedDataFormat(
+            UniVocityFixedDataFormat def)
+            throws IOException {
+        doWriteUniVocityFixedDataFormat("univocityFixed", def);
+    }
+    public void writeUniVocityHeader(UniVocityHeader def) throws IOException {
+        doWriteUniVocityHeader("univocityHeader", def);
+    }
+    public void writeUniVocityTsvDataFormat(
+            UniVocityTsvDataFormat def)
+            throws IOException {
+        doWriteUniVocityTsvDataFormat("univocityTsv", def);
+    }
+    public void writeXMLSecurityDataFormat(
+            XMLSecurityDataFormat def)
+            throws IOException {
+        doWriteXMLSecurityDataFormat("xmlSecurity", def);
+    }
+    public void writeYAMLDataFormat(YAMLDataFormat def) throws IOException {
+        doWriteYAMLDataFormat("yaml", def);
+    }
+    public void writeYAMLTypeFilterDefinition(
+            YAMLTypeFilterDefinition def)
+            throws IOException {
+        doWriteYAMLTypeFilterDefinition("typeFilter", def);
+    }
+    public void writeZipDeflaterDataFormat(
+            ZipDeflaterDataFormat def)
+            throws IOException {
+        doWriteZipDeflaterDataFormat("zipDeflater", def);
+    }
+    public void writeZipFileDataFormat(ZipFileDataFormat def) throws IOException {
+        doWriteZipFileDataFormat("zipFile", def);
+    }
+    public void writeDeadLetterChannelDefinition(
+            DeadLetterChannelDefinition def)
+            throws IOException {
+        doWriteDeadLetterChannelDefinition("deadLetterChannel", def);
+    }
+    public void writeDefaultErrorHandlerDefinition(
+            DefaultErrorHandlerDefinition def)
+            throws IOException {
+        doWriteDefaultErrorHandlerDefinition("defaultErrorHandler", def);
+    }
+    public void writeJtaTransactionErrorHandlerDefinition(
+            JtaTransactionErrorHandlerDefinition def)
+            throws IOException {
+        doWriteJtaTransactionErrorHandlerDefinition("jtaTransactionErrorHandler", def);
+    }
+    public void writeNoErrorHandlerDefinition(
+            NoErrorHandlerDefinition def)
+            throws IOException {
+        doWriteNoErrorHandlerDefinition("noErrorHandler", def);
+    }
+    public void writeRefErrorHandlerDefinition(
+            RefErrorHandlerDefinition def)
+            throws IOException {
+        doWriteRefErrorHandlerDefinition("refErrorHandler", def);
+    }
+    public void writeSpringTransactionErrorHandlerDefinition(
+            SpringTransactionErrorHandlerDefinition def)
+            throws IOException {
+        doWriteSpringTransactionErrorHandlerDefinition("springTransactionErrorHandler", def);
+    }
+    public void writeCSimpleExpression(CSimpleExpression def) throws IOException {
+        doWriteCSimpleExpression("csimple", def);
+    }
+    public void writeConstantExpression(
+            ConstantExpression def)
+            throws IOException {
+        doWriteConstantExpression("constant", def);
+    }
+    public void writeDatasonnetExpression(
+            DatasonnetExpression def)
+            throws IOException {
+        doWriteDatasonnetExpression("datasonnet", def);
+    }
+    public void writeExchangePropertyExpression(
+            ExchangePropertyExpression def)
+            throws IOException {
+        doWriteExchangePropertyExpression("exchangeProperty", def);
+    }
+    public void writeExpressionDefinition(
+            ExpressionDefinition def)
+            throws IOException {
+        doWriteExpressionDefinition("##default", def);
+    }
+    public void writeGroovyExpression(GroovyExpression def) throws IOException {
+        doWriteGroovyExpression("groovy", def);
+    }
+    public void writeHeaderExpression(HeaderExpression def) throws IOException {
+        doWriteHeaderExpression("header", def);
+    }
+    public void writeHl7TerserExpression(
+            Hl7TerserExpression def)
+            throws IOException {
+        doWriteHl7TerserExpression("hl7terser", def);
+    }
+    public void writeJavaScriptExpression(
+            JavaScriptExpression def)
+            throws IOException {
+        doWriteJavaScriptExpression("js", def);
+    }
+    public void writeJoorExpression(JoorExpression def) throws IOException {
+        doWriteJoorExpression("joor", def);
+    }
+    public void writeJqExpression(JqExpression def) throws IOException {
+        doWriteJqExpression("jq", def);
+    }
+    public void writeJsonPathExpression(
+            JsonPathExpression def)
+            throws IOException {
+        doWriteJsonPathExpression("jsonpath", def);
+    }
+    public void writeLanguageExpression(
+            LanguageExpression def)
+            throws IOException {
+        doWriteLanguageExpression("language", def);
+    }
+    public void writeMethodCallExpression(
+            MethodCallExpression def)
+            throws IOException {
+        doWriteMethodCallExpression("method", def);
+    }
+    public void writeMvelExpression(MvelExpression def) throws IOException {
+        doWriteMvelExpression("mvel", def);
+    }
+    public void writeOgnlExpression(OgnlExpression def) throws IOException {
+        doWriteOgnlExpression("ognl", def);
+    }
+    public void writePythonExpression(PythonExpression def) throws IOException {
+        doWritePythonExpression("python", def);
+    }
+    public void writeRefExpression(RefExpression def) throws IOException {
+        doWriteRefExpression("ref", def);
+    }
+    public void writeSimpleExpression(SimpleExpression def) throws IOException {
+        doWriteSimpleExpression("simple", def);
+    }
+    public void writeSpELExpression(SpELExpression def) throws IOException {
+        doWriteSpELExpression("spel", def);
+    }
+    public void writeTokenizerExpression(
+            TokenizerExpression def)
+            throws IOException {
+        doWriteTokenizerExpression("tokenize", def);
+    }
+    public void writeXMLTokenizerExpression(
+            XMLTokenizerExpression def)
+            throws IOException {
+        doWriteXMLTokenizerExpression("xtokenize", def);
+    }
+    public void writeXPathExpression(XPathExpression def) throws IOException {
+        doWriteXPathExpression("xpath", def);
+    }
+    public void writeXQueryExpression(XQueryExpression def) throws IOException {
+        doWriteXQueryExpression("xquery", def);
+    }
+    public void writeCustomLoadBalancerDefinition(
+            CustomLoadBalancerDefinition def)
+            throws IOException {
+        doWriteCustomLoadBalancerDefinition("customLoadBalancer", def);
+    }
+    public void writeFailoverLoadBalancerDefinition(
+            FailoverLoadBalancerDefinition def)
+            throws IOException {
+        doWriteFailoverLoadBalancerDefinition("failover", def);
+    }
+    public void writeRandomLoadBalancerDefinition(
+            RandomLoadBalancerDefinition def)
+            throws IOException {
+        doWriteRandomLoadBalancerDefinition("random", def);
+    }
+    public void writeRoundRobinLoadBalancerDefinition(
+            RoundRobinLoadBalancerDefinition def)
+            throws IOException {
+        doWriteRoundRobinLoadBalancerDefinition("roundRobin", def);
+    }
+    public void writeStickyLoadBalancerDefinition(
+            StickyLoadBalancerDefinition def)
+            throws IOException {
+        doWriteStickyLoadBalancerDefinition("sticky", def);
+    }
+    public void writeTopicLoadBalancerDefinition(
+            TopicLoadBalancerDefinition def)
+            throws IOException {
+        doWriteTopicLoadBalancerDefinition("topic", def);
+    }
+    public void writeWeightedLoadBalancerDefinition(
+            WeightedLoadBalancerDefinition def)
+            throws IOException {
+        doWriteWeightedLoadBalancerDefinition("weighted", def);
+    }
+    public void writeApiKeyDefinition(ApiKeyDefinition def) throws IOException {
+        doWriteApiKeyDefinition("apiKey", def);
+    }
+    public void writeBasicAuthDefinition(
+            BasicAuthDefinition def)
+            throws IOException {
+        doWriteBasicAuthDefinition("basicAuth", def);
+    }
+    public void writeBearerTokenDefinition(
+            BearerTokenDefinition def)
+            throws IOException {
+        doWriteBearerTokenDefinition("bearerToken", def);
+    }
+    public void writeDeleteDefinition(DeleteDefinition def) throws IOException {
+        doWriteDeleteDefinition("delete", def);
+    }
+    public void writeGetDefinition(GetDefinition def) throws IOException {
+        doWriteGetDefinition("get", def);
+    }
+    public void writeHeadDefinition(HeadDefinition def) throws IOException {
+        doWriteHeadDefinition("head", def);
+    }
+    public void writeMutualTLSDefinition(
+            MutualTLSDefinition def)
+            throws IOException {
+        doWriteMutualTLSDefinition("mutualTLS", def);
+    }
+    public void writeOAuth2Definition(OAuth2Definition def) throws IOException {
+        doWriteOAuth2Definition("oauth2", def);
+    }
+    public void writeOpenIdConnectDefinition(
+            OpenIdConnectDefinition def)
+            throws IOException {
+        doWriteOpenIdConnectDefinition("openIdConnect", def);
+    }
+    public void writeParamDefinition(ParamDefinition def) throws IOException {
+        doWriteParamDefinition("param", def);
+    }
+    public void writePatchDefinition(PatchDefinition def) throws IOException {
+        doWritePatchDefinition("patch", def);
+    }
+    public void writePostDefinition(PostDefinition def) throws IOException {
+        doWritePostDefinition("post", def);
+    }
+    public void writePutDefinition(PutDefinition def) throws IOException {
+        doWritePutDefinition("put", def);
+    }
+    public void writeResponseHeaderDefinition(
+            ResponseHeaderDefinition def)
+            throws IOException {
+        doWriteResponseHeaderDefinition("responseHeader", def);
+    }
+    public void writeResponseMessageDefinition(
+            ResponseMessageDefinition def)
+            throws IOException {
+        doWriteResponseMessageDefinition("responseMessage", def);
+    }
+    public void writeRestBindingDefinition(
+            RestBindingDefinition def)
+            throws IOException {
+        doWriteRestBindingDefinition("restBinding", def);
+    }
+    public void writeRestConfigurationDefinition(
+            RestConfigurationDefinition def)
+            throws IOException {
+        doWriteRestConfigurationDefinition("restConfiguration", def);
+    }
+    public void writeRestDefinition(RestDefinition def) throws IOException {
+        doWriteRestDefinition("rest", def);
+    }
+    public void writeRestPropertyDefinition(
+            RestPropertyDefinition def)
+            throws IOException {
+        doWriteRestPropertyDefinition("restProperty", def);
+    }
+    public void writeRestSecuritiesDefinition(
+            RestSecuritiesDefinition def)
+            throws IOException {
+        doWriteRestSecuritiesDefinition("securityDefinitions", def);
+    }
+    public void writeRestsDefinition(RestsDefinition def) throws IOException {
+        doWriteRestsDefinition("rests", def);
+    }
+    public void writeSecurityDefinition(
+            SecurityDefinition def)
+            throws IOException {
+        doWriteSecurityDefinition("security", def);
+    }
+    public void writeTransformersDefinition(
+            TransformersDefinition def)
+            throws IOException {
+        doWriteTransformersDefinition("transformers", def);
+    }
+    public void writeValidatorsDefinition(
+            ValidatorsDefinition def)
+            throws IOException {
+        doWriteValidatorsDefinition("validators", def);
+    }
+    protected void doWriteAggregateDefinition(
+            String name,
+            AggregateDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("aggregationStrategy", def.getAggregationStrategy());
+        doWriteAttribute("aggregationRepository", def.getAggregationRepository());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("closeCorrelationKeyOnCompletion", def.getCloseCorrelationKeyOnCompletion());
+        doWriteAttribute("discardOnAggregationFailure", def.getDiscardOnAggregationFailure());
+        doWriteAttribute("eagerCheckCompletion", def.getEagerCheckCompletion());
+        doWriteAttribute("timeoutCheckerExecutorService", def.getTimeoutCheckerExecutorService());
+        doWriteAttribute("completionOnNewCorrelationGroup", def.getCompletionOnNewCorrelationGroup());
+        doWriteAttribute("completionInterval", def.getCompletionInterval());
+        doWriteAttribute("parallelProcessing", def.getParallelProcessing());
+        doWriteAttribute("forceCompletionOnStop", def.getForceCompletionOnStop());
+        doWriteAttribute("aggregationStrategyMethodAllowNull", def.getAggregationStrategyMethodAllowNull());
+        doWriteAttribute("completionFromBatchConsumer", def.getCompletionFromBatchConsumer());
+        doWriteAttribute("completeAllOnStop", def.getCompleteAllOnStop());
+        doWriteAttribute("completionSize", def.getCompletionSize());
+        doWriteAttribute("aggregationStrategyMethodName", def.getAggregationStrategyMethodName());
+        doWriteAttribute("aggregateController", def.getAggregateController());
+        doWriteAttribute("completionTimeout", def.getCompletionTimeout());
+        doWriteAttribute("ignoreInvalidCorrelationKeys", def.getIgnoreInvalidCorrelationKeys());
+        doWriteAttribute("discardOnCompletionTimeout", def.getDiscardOnCompletionTimeout());
+        doWriteAttribute("completionTimeoutCheckerInterval", def.getCompletionTimeoutCheckerInterval());
+        doWriteAttribute("optimisticLocking", def.getOptimisticLocking());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        doWriteElement("optimisticLockRetryPolicy", def.getOptimisticLockRetryPolicyDefinition(), this::doWriteOptimisticLockRetryPolicyDefinition);
+        doWriteElement("correlationExpression", def.getCorrelationExpression(), this::doWriteExpressionSubElementDefinition);
+        doWriteElement("completionPredicate", def.getCompletionPredicate(), this::doWriteExpressionSubElementDefinition);
+        doWriteElement("completionSizeExpression", def.getCompletionSizeExpression(), this::doWriteExpressionSubElementDefinition);
+        doWriteElement("completionTimeoutExpression", def.getCompletionTimeoutExpression(), this::doWriteExpressionSubElementDefinition);
+        endElement();
+    }
+    protected void doWriteBeanDefinition(
+            String name,
+            BeanDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteAttribute("method", def.getMethod());
+        doWriteAttribute("scope", def.getScope());
+        doWriteAttribute("beanType", def.getBeanType());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    void doWriteBeanFactoryDefinitionAttributes(
+            BeanFactoryDefinition<?, ?> def)
+            throws IOException {
+        doWriteAttribute("name", def.getName());
+        doWriteAttribute("type", def.getType());
+        doWriteAttribute("beanType", def.getBeanType());
+    }
+    void doWriteBeanFactoryDefinitionElements(
+            BeanFactoryDefinition<?, ?> def)
+            throws IOException {
+        doWriteElement("script", def.getScript(), this::doWriteString);
+        doWriteList(null, "property", def.getProperties(), this::doWritePropertyDefinition);
+    }
+    protected void doWriteBeanFactoryDefinition(
+            String name,
+            BeanFactoryDefinition<?, ?> def)
+            throws IOException {
+        startElement(name);
+        doWriteBeanFactoryDefinitionAttributes(def);
+        doWriteBeanFactoryDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteCatchDefinition(
+            String name,
+            CatchDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        doWriteElement("onWhen", def.getOnWhen(), this::doWriteWhenDefinition);
+        doWriteList(null, "exception", def.getExceptions(), this::doWriteString);
+        endElement();
+    }
+    protected void doWriteChoiceDefinition(
+            String name,
+            ChoiceDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("precondition", def.getPrecondition());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement("otherwise", def.getOtherwise(), this::doWriteOtherwiseDefinition);
+        doWriteList(null, null, def.getWhenClauses(), this::doWriteWhenDefinitionRef);
+        endElement();
+    }
+    protected void doWriteCircuitBreakerDefinition(
+            String name,
+            CircuitBreakerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("configuration", def.getConfiguration());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement("faultToleranceConfiguration", def.getFaultToleranceConfiguration(), this::doWriteFaultToleranceConfigurationDefinition);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        doWriteElement("resilience4jConfiguration", def.getResilience4jConfiguration(), this::doWriteResilience4jConfigurationDefinition);
+        endElement();
+    }
+    protected void doWriteClaimCheckDefinition(
+            String name,
+            ClaimCheckDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("filter", def.getFilter());
+        doWriteAttribute("aggregationStrategy", def.getAggregationStrategy());
+        doWriteAttribute("aggregationStrategyMethodName", def.getAggregationStrategyMethodName());
+        doWriteAttribute("operation", def.getOperation());
+        doWriteAttribute("key", def.getKey());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteContextScanDefinition(
+            String name,
+            ContextScanDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("includeNonSingletons", def.getIncludeNonSingletons());
+        doWriteList(null, "excludes", def.getExcludes(), this::doWriteString);
+        doWriteList(null, "includes", def.getIncludes(), this::doWriteString);
+        endElement();
+    }
+    protected void doWriteConvertBodyDefinition(
+            String name,
+            ConvertBodyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("charset", def.getCharset());
+        doWriteAttribute("type", def.getType());
+        doWriteAttribute("mandatory", def.getMandatory());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    void doWriteDataFormatDefinitionAttributes(
+            DataFormatDefinition def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+    }
+    protected void doWriteDataFormatDefinition(
+            String name,
+            DataFormatDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteDataFormatDefinitionAttributes(def);
+        endElement();
+    }
+    protected void doWriteDelayDefinition(
+            String name,
+            DelayDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("callerRunsWhenRejected", def.getCallerRunsWhenRejected());
+        doWriteAttribute("asyncDelayed", def.getAsyncDelayed());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteDescriptionDefinition(
+            String name,
+            DescriptionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("lang", def.getLang());
+        doWriteValue(def.getText());
+        endElement();
+    }
+    protected void doWriteDynamicRouterDefinition(
+            String name,
+            DynamicRouterDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("uriDelimiter", def.getUriDelimiter());
+        doWriteAttribute("ignoreInvalidEndpoints", def.getIgnoreInvalidEndpoints());
+        doWriteAttribute("cacheSize", def.getCacheSize());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteEnrichDefinition(
+            String name,
+            EnrichDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("cacheSize", def.getCacheSize());
+        doWriteAttribute("aggregationStrategy", def.getAggregationStrategy());
+        doWriteAttribute("ignoreInvalidEndpoint", def.getIgnoreInvalidEndpoint());
+        doWriteAttribute("allowOptimisedComponents", def.getAllowOptimisedComponents());
+        doWriteAttribute("aggregateOnException", def.getAggregateOnException());
+        doWriteAttribute("aggregationStrategyMethodName", def.getAggregationStrategyMethodName());
+        doWriteAttribute("shareUnitOfWork", def.getShareUnitOfWork());
+        doWriteAttribute("aggregationStrategyMethodAllowNull", def.getAggregationStrategyMethodAllowNull());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteErrorHandlerDefinition(
+            String name,
+            ErrorHandlerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteElement(null, def.getErrorHandlerType(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "DeadLetterChannelDefinition" -> doWriteDeadLetterChannelDefinition("deadLetterChannel", (DeadLetterChannelDefinition) def.getErrorHandlerType());
+                case "DefaultErrorHandlerDefinition" -> doWriteDefaultErrorHandlerDefinition("defaultErrorHandler", (DefaultErrorHandlerDefinition) def.getErrorHandlerType());
+                case "NoErrorHandlerDefinition" -> doWriteNoErrorHandlerDefinition("noErrorHandler", (NoErrorHandlerDefinition) def.getErrorHandlerType());
+                case "JtaTransactionErrorHandlerDefinition" -> doWriteJtaTransactionErrorHandlerDefinition("jtaTransactionErrorHandler", (JtaTransactionErrorHandlerDefinition) def.getErrorHandlerType());
+                case "SpringTransactionErrorHandlerDefinition" -> doWriteSpringTransactionErrorHandlerDefinition("springTransactionErrorHandler", (SpringTransactionErrorHandlerDefinition) def.getErrorHandlerType());
+            }
+        });
+        endElement();
+    }
+    void doWriteExpressionNodeAttributes(ExpressionNode def) throws IOException {
+        doWriteProcessorDefinitionAttributes(def);
+    }
+    void doWriteExpressionNodeElements(ExpressionNode def) throws IOException {
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement(null, def.getExpression(), this::doWriteExpressionDefinitionRef);
+    }
+    protected void doWriteExpressionNode(
+            String name,
+            ExpressionNode def)
+            throws IOException {
+        startElement(name);
+        doWriteExpressionNodeAttributes(def);
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteExpressionSubElementDefinition(
+            String name,
+            ExpressionSubElementDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteElement(null, def.getExpressionType(), this::doWriteExpressionDefinitionRef);
+        endElement();
+    }
+    void doWriteFaultToleranceConfigurationCommonAttributes(
+            FaultToleranceConfigurationCommon def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("failureRatio", def.getFailureRatio());
+        doWriteAttribute("timeoutScheduledExecutorService", def.getTimeoutScheduledExecutorService());
+        doWriteAttribute("timeoutDuration", def.getTimeoutDuration());
+        doWriteAttribute("timeoutEnabled", def.getTimeoutEnabled());
+        doWriteAttribute("timeoutPoolSize", def.getTimeoutPoolSize());
+        doWriteAttribute("successThreshold", def.getSuccessThreshold());
+        doWriteAttribute("requestVolumeThreshold", def.getRequestVolumeThreshold());
+        doWriteAttribute("bulkheadExecutorService", def.getBulkheadExecutorService());
+        doWriteAttribute("delay", def.getDelay());
+        doWriteAttribute("bulkheadWaitingTaskQueue", def.getBulkheadWaitingTaskQueue());
+        doWriteAttribute("circuitBreaker", def.getCircuitBreaker());
+        doWriteAttribute("bulkheadMaxConcurrentCalls", def.getBulkheadMaxConcurrentCalls());
+        doWriteAttribute("bulkheadEnabled", def.getBulkheadEnabled());
+    }
+    protected void doWriteFaultToleranceConfigurationCommon(
+            String name,
+            FaultToleranceConfigurationCommon def)
+            throws IOException {
+        startElement(name);
+        doWriteFaultToleranceConfigurationCommonAttributes(def);
+        endElement();
+    }
+    protected void doWriteFaultToleranceConfigurationDefinition(
+            String name,
+            FaultToleranceConfigurationDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteFaultToleranceConfigurationCommonAttributes(def);
+        endElement();
+    }
+    protected void doWriteFilterDefinition(
+            String name,
+            FilterDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("statusPropertyName", def.getStatusPropertyName());
+        doWriteOutputExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteFinallyDefinition(
+            String name,
+            FinallyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteFromDefinition(
+            String name,
+            FromDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("uri", def.getUri());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteGlobalOptionDefinition(
+            String name,
+            GlobalOptionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("value", def.getValue());
+        doWriteAttribute("key", def.getKey());
+        endElement();
+    }
+    protected void doWriteGlobalOptionsDefinition(
+            String name,
+            GlobalOptionsDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, "globalOption", def.getGlobalOptions(), this::doWriteGlobalOptionDefinition);
+        endElement();
+    }
+    protected void doWriteIdempotentConsumerDefinition(
+            String name,
+            IdempotentConsumerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("completionEager", def.getCompletionEager());
+        doWriteAttribute("skipDuplicate", def.getSkipDuplicate());
+        doWriteAttribute("eager", def.getEager());
+        doWriteAttribute("idempotentRepository", def.getIdempotentRepository());
+        doWriteAttribute("removeOnFailure", def.getRemoveOnFailure());
+        doWriteOutputExpressionNodeElements(def);
+        endElement();
+    }
+    void doWriteIdentifiedTypeAttributes(IdentifiedType def) throws IOException {
+        doWriteAttribute("id", def.getId());
+    }
+    protected void doWriteIdentifiedType(
+            String name,
+            IdentifiedType def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteInOnlyDefinition(
+            String name,
+            InOnlyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteSendDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteInOutDefinition(
+            String name,
+            InOutDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteSendDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteInputTypeDefinition(
+            String name,
+            InputTypeDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("urn", def.getUrn());
+        doWriteAttribute("validate", def.getValidate());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    void doWriteInterceptDefinitionAttributes(
+            InterceptDefinition def)
+            throws IOException {
+        doWriteProcessorDefinitionAttributes(def);
+    }
+    void doWriteInterceptDefinitionElements(
+            InterceptDefinition def)
+            throws IOException {
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+    }
+    protected void doWriteInterceptDefinition(
+            String name,
+            InterceptDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteInterceptDefinitionAttributes(def);
+        doWriteInterceptDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteInterceptFromDefinition(
+            String name,
+            InterceptFromDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("uri", def.getUri());
+        doWriteInterceptDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteInterceptSendToEndpointDefinition(
+            String name,
+            InterceptSendToEndpointDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("afterUri", def.getAfterUri());
+        doWriteAttribute("uri", def.getUri());
+        doWriteAttribute("skipSendToOriginalEndpoint", def.getSkipSendToOriginalEndpoint());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteKameletDefinition(
+            String name,
+            KameletDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("name", def.getName());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteLoadBalanceDefinition(
+            String name,
+            LoadBalanceDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        doWriteElement(null, def.getLoadBalancerType(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "CustomLoadBalancerDefinition" -> doWriteCustomLoadBalancerDefinition("customLoadBalancer", (CustomLoadBalancerDefinition) def.getLoadBalancerType());
+                case "FailoverLoadBalancerDefinition" -> doWriteFailoverLoadBalancerDefinition("failover", (FailoverLoadBalancerDefinition) def.getLoadBalancerType());
+                case "RandomLoadBalancerDefinition" -> doWriteRandomLoadBalancerDefinition("random", (RandomLoadBalancerDefinition) def.getLoadBalancerType());
+                case "RoundRobinLoadBalancerDefinition" -> doWriteRoundRobinLoadBalancerDefinition("roundRobin", (RoundRobinLoadBalancerDefinition) def.getLoadBalancerType());
+                case "StickyLoadBalancerDefinition" -> doWriteStickyLoadBalancerDefinition("sticky", (StickyLoadBalancerDefinition) def.getLoadBalancerType());
+                case "TopicLoadBalancerDefinition" -> doWriteTopicLoadBalancerDefinition("topic", (TopicLoadBalancerDefinition) def.getLoadBalancerType());
+                case "WeightedLoadBalancerDefinition" -> doWriteWeightedLoadBalancerDefinition("weighted", (WeightedLoadBalancerDefinition) def.getLoadBalancerType());
+            }
+        });
+        endElement();
+    }
+    void doWriteLoadBalancerDefinitionAttributes(
+            LoadBalancerDefinition def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+    }
+    protected void doWriteLoadBalancerDefinition(
+            String name,
+            LoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteLoadBalancerDefinitionAttributes(def);
+        endElement();
+    }
+    protected void doWriteLogDefinition(
+            String name,
+            LogDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("logName", def.getLogName());
+        doWriteAttribute("marker", def.getMarker());
+        doWriteAttribute("logger", def.getLogger());
+        doWriteAttribute("message", def.getMessage());
+        doWriteAttribute("loggingLevel", def.getLoggingLevel());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteLoopDefinition(
+            String name,
+            LoopDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("doWhile", def.getDoWhile());
+        doWriteAttribute("breakOnShutdown", def.getBreakOnShutdown());
+        doWriteAttribute("copy", def.getCopy());
+        doWriteOutputExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteMarshalDefinition(
+            String name,
+            MarshalDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement(null, def.getDataFormatType(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "ASN1DataFormat" -> doWriteASN1DataFormat("asn1", (ASN1DataFormat) def.getDataFormatType());
+                case "AvroDataFormat" -> doWriteAvroDataFormat("avro", (AvroDataFormat) def.getDataFormatType());
+                case "BarcodeDataFormat" -> doWriteBarcodeDataFormat("barcode", (BarcodeDataFormat) def.getDataFormatType());
+                case "Base64DataFormat" -> doWriteBase64DataFormat("base64", (Base64DataFormat) def.getDataFormatType());
+                case "BindyDataFormat" -> doWriteBindyDataFormat("bindy", (BindyDataFormat) def.getDataFormatType());
+                case "CBORDataFormat" -> doWriteCBORDataFormat("cbor", (CBORDataFormat) def.getDataFormatType());
+                case "CryptoDataFormat" -> doWriteCryptoDataFormat("crypto", (CryptoDataFormat) def.getDataFormatType());
+                case "CsvDataFormat" -> doWriteCsvDataFormat("csv", (CsvDataFormat) def.getDataFormatType());
+                case "CustomDataFormat" -> doWriteCustomDataFormat("custom", (CustomDataFormat) def.getDataFormatType());
+                case "FhirJsonDataFormat" -> doWriteFhirJsonDataFormat("fhirJson", (FhirJsonDataFormat) def.getDataFormatType());
+                case "FhirXmlDataFormat" -> doWriteFhirXmlDataFormat("fhirXml", (FhirXmlDataFormat) def.getDataFormatType());
+                case "FlatpackDataFormat" -> doWriteFlatpackDataFormat("flatpack", (FlatpackDataFormat) def.getDataFormatType());
+                case "GrokDataFormat" -> doWriteGrokDataFormat("grok", (GrokDataFormat) def.getDataFormatType());
+                case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) def.getDataFormatType());
+                case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) def.getDataFormatType());
+                case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) def.getDataFormatType());
+                case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) def.getDataFormatType());
+                case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) def.getDataFormatType());
+                case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) def.getDataFormatType());
+                case "JsonApiDataFormat" -> doWriteJsonApiDataFormat("jsonApi", (JsonApiDataFormat) def.getDataFormatType());
+                case "LZFDataFormat" -> doWriteLZFDataFormat("lzf", (LZFDataFormat) def.getDataFormatType());
+                case "MimeMultipartDataFormat" -> doWriteMimeMultipartDataFormat("mimeMultipart", (MimeMultipartDataFormat) def.getDataFormatType());
+                case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) def.getDataFormatType());
+                case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) def.getDataFormatType());
+                case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) def.getDataFormatType());
+                case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) def.getDataFormatType());
+                case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) def.getDataFormatType());
+                case "SyslogDataFormat" -> doWriteSyslogDataFormat("syslog", (SyslogDataFormat) def.getDataFormatType());
+                case "TarFileDataFormat" -> doWriteTarFileDataFormat("tarFile", (TarFileDataFormat) def.getDataFormatType());
+                case "ThriftDataFormat" -> doWriteThriftDataFormat("thrift", (ThriftDataFormat) def.getDataFormatType());
+                case "TidyMarkupDataFormat" -> doWriteTidyMarkupDataFormat("tidyMarkup", (TidyMarkupDataFormat) def.getDataFormatType());
+                case "UniVocityCsvDataFormat" -> doWriteUniVocityCsvDataFormat("univocityCsv", (UniVocityCsvDataFormat) def.getDataFormatType());
+                case "UniVocityFixedDataFormat" -> doWriteUniVocityFixedDataFormat("univocityFixed", (UniVocityFixedDataFormat) def.getDataFormatType());
+                case "UniVocityTsvDataFormat" -> doWriteUniVocityTsvDataFormat("univocityTsv", (UniVocityTsvDataFormat) def.getDataFormatType());
+                case "XMLSecurityDataFormat" -> doWriteXMLSecurityDataFormat("xmlSecurity", (XMLSecurityDataFormat) def.getDataFormatType());
+                case "PGPDataFormat" -> doWritePGPDataFormat("pgp", (PGPDataFormat) def.getDataFormatType());
+                case "YAMLDataFormat" -> doWriteYAMLDataFormat("yaml", (YAMLDataFormat) def.getDataFormatType());
+                case "ZipDeflaterDataFormat" -> doWriteZipDeflaterDataFormat("zipDeflater", (ZipDeflaterDataFormat) def.getDataFormatType());
+                case "ZipFileDataFormat" -> doWriteZipFileDataFormat("zipFile", (ZipFileDataFormat) def.getDataFormatType());
+            }
+        });
+        endElement();
+    }
+    protected void doWriteMulticastDefinition(
+            String name,
+            MulticastDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("aggregationStrategy", def.getAggregationStrategy());
+        doWriteAttribute("onPrepare", def.getOnPrepare());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("aggregationStrategyMethodName", def.getAggregationStrategyMethodName());
+        doWriteAttribute("timeout", def.getTimeout());
+        doWriteAttribute("streaming", def.getStreaming());
+        doWriteAttribute("stopOnException", def.getStopOnException());
+        doWriteAttribute("parallelProcessing", def.getParallelProcessing());
+        doWriteAttribute("parallelAggregate", def.getParallelAggregate());
+        doWriteAttribute("shareUnitOfWork", def.getShareUnitOfWork());
+        doWriteAttribute("aggregationStrategyMethodAllowNull", def.getAggregationStrategyMethodAllowNull());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteOnCompletionDefinition(
+            String name,
+            OnCompletionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("parallelProcessing", def.getParallelProcessing());
+        doWriteAttribute("useOriginalMessage", def.getUseOriginalMessage());
+        doWriteAttribute("mode", def.getMode());
+        doWriteAttribute("onCompleteOnly", def.getOnCompleteOnly());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("onFailureOnly", def.getOnFailureOnly());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement("onWhen", def.getOnWhen(), this::doWriteWhenDefinition);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteOnExceptionDefinition(
+            String name,
+            OnExceptionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("useOriginalMessage", def.getUseOriginalMessage());
+        doWriteAttribute("onRedeliveryRef", def.getOnRedeliveryRef());
+        doWriteAttribute("useOriginalBody", def.getUseOriginalBody());
+        doWriteAttribute("onExceptionOccurredRef", def.getOnExceptionOccurredRef());
+        doWriteAttribute("redeliveryPolicyRef", def.getRedeliveryPolicyRef());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        doWriteElement("continued", def.getContinued(), this::doWriteExpressionSubElementDefinition);
+        doWriteList(null, "exception", def.getExceptions(), this::doWriteString);
+        doWriteElement("retryWhile", def.getRetryWhile(), this::doWriteExpressionSubElementDefinition);
+        doWriteElement("redeliveryPolicy", def.getRedeliveryPolicyType(), this::doWriteRedeliveryPolicyDefinition);
+        doWriteElement("handled", def.getHandled(), this::doWriteExpressionSubElementDefinition);
+        doWriteElement("onWhen", def.getOnWhen(), this::doWriteWhenDefinition);
+        endElement();
+    }
+    protected void doWriteOnFallbackDefinition(
+            String name,
+            OnFallbackDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("fallbackViaNetwork", def.getFallbackViaNetwork());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteOptimisticLockRetryPolicyDefinition(
+            String name,
+            OptimisticLockRetryPolicyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("retryDelay", def.getRetryDelay());
+        doWriteAttribute("randomBackOff", def.getRandomBackOff());
+        doWriteAttribute("maximumRetries", def.getMaximumRetries());
+        doWriteAttribute("exponentialBackOff", def.getExponentialBackOff());
+        doWriteAttribute("maximumRetryDelay", def.getMaximumRetryDelay());
+        endElement();
+    }
+    void doWriteOptionalIdentifiedDefinitionAttributes(
+            OptionalIdentifiedDefinition<?> def)
+            throws IOException {
+        doWriteAttribute("id", def.getId());
+        doWriteAttribute("customId", toString(def.getCustomId()));
+    }
+    void doWriteOptionalIdentifiedDefinitionElements(
+            OptionalIdentifiedDefinition<?> def)
+            throws IOException {
+        doWriteElement("description", def.getDescription(), this::doWriteDescriptionDefinition);
+    }
+    protected void doWriteOptionalIdentifiedDefinition(
+            String name,
+            OptionalIdentifiedDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteOtherwiseDefinition(
+            String name,
+            OtherwiseDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    void doWriteOutputExpressionNodeAttributes(
+            OutputExpressionNode def)
+            throws IOException {
+        doWriteProcessorDefinitionAttributes(def);
+    }
+    void doWriteOutputExpressionNodeElements(
+            OutputExpressionNode def)
+            throws IOException {
+        doWriteExpressionNodeElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+    }
+    protected void doWriteOutputExpressionNode(
+            String name,
+            OutputExpressionNode def)
+            throws IOException {
+        startElement(name);
+        doWriteOutputExpressionNodeAttributes(def);
+        doWriteOutputExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteOutputTypeDefinition(
+            String name,
+            OutputTypeDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("urn", def.getUrn());
+        doWriteAttribute("validate", def.getValidate());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWritePackageScanDefinition(
+            String name,
+            PackageScanDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, "excludes", def.getExcludes(), this::doWriteString);
+        doWriteList(null, "includes", def.getIncludes(), this::doWriteString);
+        doWriteList(null, "package", def.getPackages(), this::doWriteString);
+        endElement();
+    }
+    protected void doWritePausableDefinition(
+            String name,
+            PausableDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("untilCheck", def.getUntilCheck());
+        doWriteAttribute("consumerListener", def.getConsumerListener());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWritePipelineDefinition(
+            String name,
+            PipelineDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWritePolicyDefinition(
+            String name,
+            PolicyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWritePollEnrichDefinition(
+            String name,
+            PollEnrichDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("cacheSize", def.getCacheSize());
+        doWriteAttribute("aggregationStrategy", def.getAggregationStrategy());
+        doWriteAttribute("ignoreInvalidEndpoint", def.getIgnoreInvalidEndpoint());
+        doWriteAttribute("aggregateOnException", def.getAggregateOnException());
+        doWriteAttribute("aggregationStrategyMethodName", def.getAggregationStrategyMethodName());
+        doWriteAttribute("timeout", def.getTimeout());
+        doWriteAttribute("aggregationStrategyMethodAllowNull", def.getAggregationStrategyMethodAllowNull());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteProcessDefinition(
+            String name,
+            ProcessDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    void doWriteProcessorDefinitionAttributes(
+            ProcessorDefinition<?> def)
+            throws IOException {
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("inheritErrorHandler", toString(def.isInheritErrorHandler()));
+        doWriteAttribute("disabled", def.getDisabled());
+    }
+    void doWriteProcessorDefinitionElements(
+            ProcessorDefinition<?> def)
+            throws IOException {
+        doWriteOptionalIdentifiedDefinitionElements(def);
+    }
+    protected void doWriteProcessorDefinition(
+            String name,
+            ProcessorDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteProcessorDefinitionElements(def);
+        endElement();
+    }
+    protected void doWritePropertyDefinition(
+            String name,
+            PropertyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("value", def.getValue());
+        doWriteAttribute("key", def.getKey());
+        endElement();
+    }
+    protected void doWritePropertyDefinitions(
+            String name,
+            PropertyDefinitions def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, "property", def.getProperties(), this::doWritePropertyDefinition);
+        endElement();
+    }
+    protected void doWritePropertyExpressionDefinition(
+            String name,
+            PropertyExpressionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("key", def.getKey());
+        doWriteElement(null, def.getExpression(), this::doWriteExpressionDefinitionRef);
+        endElement();
+    }
+    protected void doWriteRecipientListDefinition(
+            String name,
+            RecipientListDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("cacheSize", def.getCacheSize());
+        doWriteAttribute("aggregationStrategy", def.getAggregationStrategy());
+        doWriteAttribute("onPrepare", def.getOnPrepare());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("aggregationStrategyMethodName", def.getAggregationStrategyMethodName());
+        doWriteAttribute("timeout", def.getTimeout());
+        doWriteAttribute("ignoreInvalidEndpoints", def.getIgnoreInvalidEndpoints());
+        doWriteAttribute("streaming", def.getStreaming());
+        doWriteAttribute("stopOnException", def.getStopOnException());
+        doWriteAttribute("delimiter", def.getDelimiter());
+        doWriteAttribute("parallelProcessing", def.getParallelProcessing());
+        doWriteAttribute("parallelAggregate", def.getParallelAggregate());
+        doWriteAttribute("shareUnitOfWork", def.getShareUnitOfWork());
+        doWriteAttribute("aggregationStrategyMethodAllowNull", def.getAggregationStrategyMethodAllowNull());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteRedeliveryPolicyDefinition(
+            String name,
+            RedeliveryPolicyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("logNewException", def.getLogNewException());
+        doWriteAttribute("backOffMultiplier", def.getBackOffMultiplier());
+        doWriteAttribute("exchangeFormatterRef", def.getExchangeFormatterRef());
+        doWriteAttribute("allowRedeliveryWhileStopping", def.getAllowRedeliveryWhileStopping());
+        doWriteAttribute("delayPattern", def.getDelayPattern());
+        doWriteAttribute("retriesExhaustedLogLevel", def.getRetriesExhaustedLogLevel());
+        doWriteAttribute("logStackTrace", def.getLogStackTrace());
+        doWriteAttribute("retryAttemptedLogInterval", def.getRetryAttemptedLogInterval());
+        doWriteAttribute("logRetryAttempted", def.getLogRetryAttempted());
+        doWriteAttribute("maximumRedeliveryDelay", def.getMaximumRedeliveryDelay());
+        doWriteAttribute("useExponentialBackOff", def.getUseExponentialBackOff());
+        doWriteAttribute("logExhaustedMessageHistory", def.getLogExhaustedMessageHistory());
+        doWriteAttribute("collisionAvoidanceFactor", def.getCollisionAvoidanceFactor());
+        doWriteAttribute("logRetryStackTrace", def.getLogRetryStackTrace());
+        doWriteAttribute("asyncDelayedRedelivery", def.getAsyncDelayedRedelivery());
+        doWriteAttribute("disableRedelivery", def.getDisableRedelivery());
+        doWriteAttribute("logContinued", def.getLogContinued());
+        doWriteAttribute("retryAttemptedLogLevel", def.getRetryAttemptedLogLevel());
+        doWriteAttribute("redeliveryDelay", def.getRedeliveryDelay());
+        doWriteAttribute("logExhaustedMessageBody", def.getLogExhaustedMessageBody());
+        doWriteAttribute("logHandled", def.getLogHandled());
+        doWriteAttribute("maximumRedeliveries", def.getMaximumRedeliveries());
+        doWriteAttribute("logExhausted", def.getLogExhausted());
+        doWriteAttribute("useCollisionAvoidance", def.getUseCollisionAvoidance());
+        endElement();
+    }
+    protected void doWriteRemoveHeaderDefinition(
+            String name,
+            RemoveHeaderDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("name", def.getName());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteRemoveHeadersDefinition(
+            String name,
+            RemoveHeadersDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("excludePattern", def.getExcludePattern());
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteRemovePropertiesDefinition(
+            String name,
+            RemovePropertiesDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("excludePattern", def.getExcludePattern());
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteRemovePropertyDefinition(
+            String name,
+            RemovePropertyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("name", def.getName());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteResequenceDefinition(
+            String name,
+            ResequenceDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        doWriteElement(null, def.getExpression(), this::doWriteExpressionDefinitionRef);
+        doWriteElement(null, def.getResequencerConfig(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "BatchResequencerConfig" -> doWriteBatchResequencerConfig("batch-config", (BatchResequencerConfig) def.getResequencerConfig());
+                case "StreamResequencerConfig" -> doWriteStreamResequencerConfig("stream-config", (StreamResequencerConfig) def.getResequencerConfig());
+            }
+        });
+        endElement();
+    }
+    void doWriteResilience4jConfigurationCommonAttributes(
+            Resilience4jConfigurationCommon def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("failureRateThreshold", def.getFailureRateThreshold());
+        doWriteAttribute("slowCallDurationThreshold", def.getSlowCallDurationThreshold());
+        doWriteAttribute("minimumNumberOfCalls", def.getMinimumNumberOfCalls());
+        doWriteAttribute("permittedNumberOfCallsInHalfOpenState", def.getPermittedNumberOfCallsInHalfOpenState());
+        doWriteAttribute("throwExceptionWhenHalfOpenOrOpenState", def.getThrowExceptionWhenHalfOpenOrOpenState());
+        doWriteAttribute("slowCallRateThreshold", def.getSlowCallRateThreshold());
+        doWriteAttribute("writableStackTraceEnabled", def.getWritableStackTraceEnabled());
+        doWriteAttribute("automaticTransitionFromOpenToHalfOpenEnabled", def.getAutomaticTransitionFromOpenToHalfOpenEnabled());
+        doWriteAttribute("circuitBreaker", def.getCircuitBreaker());
+        doWriteAttribute("slidingWindowSize", def.getSlidingWindowSize());
+        doWriteAttribute("config", def.getConfig());
+        doWriteAttribute("slidingWindowType", def.getSlidingWindowType());
+        doWriteAttribute("waitDurationInOpenState", def.getWaitDurationInOpenState());
+    }
+    void doWriteResilience4jConfigurationCommonElements(
+            Resilience4jConfigurationCommon def)
+            throws IOException {
+        doWriteElement("bulkheadMaxWaitDuration", def.getBulkheadMaxWaitDuration(), this::doWriteString);
+        doWriteElement("timeoutCancelRunningFuture", def.getTimeoutCancelRunningFuture(), this::doWriteString);
+        doWriteElement("timeoutDuration", def.getTimeoutDuration(), this::doWriteString);
+        doWriteElement("timeoutEnabled", def.getTimeoutEnabled(), this::doWriteString);
+        doWriteElement("timeoutExecutorService", def.getTimeoutExecutorService(), this::doWriteString);
+        doWriteElement("bulkheadMaxConcurrentCalls", def.getBulkheadMaxConcurrentCalls(), this::doWriteString);
+        doWriteElement("bulkheadEnabled", def.getBulkheadEnabled(), this::doWriteString);
+    }
+    protected void doWriteResilience4jConfigurationCommon(
+            String name,
+            Resilience4jConfigurationCommon def)
+            throws IOException {
+        startElement(name);
+        doWriteResilience4jConfigurationCommonAttributes(def);
+        doWriteResilience4jConfigurationCommonElements(def);
+        endElement();
+    }
+    protected void doWriteResilience4jConfigurationDefinition(
+            String name,
+            Resilience4jConfigurationDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteResilience4jConfigurationCommonAttributes(def);
+        doWriteResilience4jConfigurationCommonElements(def);
+        endElement();
+    }
+    protected void doWriteRestContextRefDefinition(
+            String name,
+            RestContextRefDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteResumableDefinition(
+            String name,
+            ResumableDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("resumeStrategy", def.getResumeStrategy());
+        doWriteAttribute("intermittent", def.getIntermittent());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement("loggingLevel", def.getLoggingLevel(), this::doWriteString);
+        endElement();
+    }
+    protected void doWriteRollbackDefinition(
+            String name,
+            RollbackDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("markRollbackOnly", def.getMarkRollbackOnly());
+        doWriteAttribute("message", def.getMessage());
+        doWriteAttribute("markRollbackOnlyLast", def.getMarkRollbackOnlyLast());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteRouteBuilderDefinition(
+            String name,
+            RouteBuilderDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteRouteConfigurationContextRefDefinition(
+            String name,
+            RouteConfigurationContextRefDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteRouteConfigurationDefinition(
+            String name,
+            RouteConfigurationDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("precondition", def.getPrecondition());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, "onException", def.getOnExceptions(), this::doWriteOnExceptionDefinition);
+        doWriteList(null, "onCompletion", def.getOnCompletions(), this::doWriteOnCompletionDefinition);
+        doWriteList(null, "interceptSendToEndpoint", def.getInterceptSendTos(), this::doWriteInterceptSendToEndpointDefinition);
+        doWriteElement("errorHandler", def.getErrorHandler(), this::doWriteErrorHandlerDefinition);
+        doWriteList(null, "interceptFrom", def.getInterceptFroms(), this::doWriteInterceptFromDefinition);
+        doWriteList(null, "intercept", def.getIntercepts(), this::doWriteInterceptDefinition);
+        endElement();
+    }
+    protected void doWriteRouteConfigurationsDefinition(
+            String name,
+            RouteConfigurationsDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, null, def.getRouteConfigurations(), this::doWriteRouteConfigurationDefinitionRef);
+        endElement();
+    }
+    protected void doWriteRouteContextRefDefinition(
+            String name,
+            RouteContextRefDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteRouteDefinition(
+            String name,
+            RouteDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("template", toString(def.isTemplate()));
+        doWriteAttribute("routeConfigurationId", def.getRouteConfigurationId());
+        doWriteAttribute("streamCache", def.getStreamCache());
+        doWriteAttribute("trace", def.getTrace());
+        doWriteAttribute("rest", toString(def.isRest()));
+        doWriteAttribute("routePolicyRef", def.getRoutePolicyRef());
+        doWriteAttribute("precondition", def.getPrecondition());
+        doWriteAttribute("shutdownRoute", def.getShutdownRoute());
+        doWriteAttribute("shutdownRunningTask", def.getShutdownRunningTask());
+        doWriteAttribute("startupOrder", toString(def.getStartupOrder()));
+        doWriteAttribute("logMask", def.getLogMask());
+        doWriteAttribute("nodePrefixId", def.getNodePrefixId());
+        doWriteAttribute("messageHistory", def.getMessageHistory());
+        doWriteAttribute("autoStartup", def.getAutoStartup());
+        doWriteAttribute("delayer", def.getDelayer());
+        doWriteAttribute("group", def.getGroup());
+        doWriteAttribute("errorHandlerRef", def.getErrorHandlerRef());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, "routeProperty", def.getRouteProperties(), this::doWritePropertyDefinition);
+        doWriteElement(null, def.getInput(), this::doWriteFromDefinitionRef);
+        doWriteElement(null, def.getInputType(), this::doWriteInputTypeDefinitionRef);
+        doWriteElement(null, def.getOutputType(), this::doWriteOutputTypeDefinitionRef);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteRouteTemplateBeanDefinition(
+            String name,
+            RouteTemplateBeanDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteBeanFactoryDefinitionAttributes(def);
+        doWriteBeanFactoryDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteRouteTemplateContextRefDefinition(
+            String name,
+            RouteTemplateContextRefDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteRouteTemplateDefinition(
+            String name,
+            RouteTemplateDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, "templateParameter", def.getTemplateParameters(), this::doWriteRouteTemplateParameterDefinition);
+        doWriteElement("route", def.getRoute(), this::doWriteRouteDefinition);
+        doWriteList(null, "templateBean", def.getTemplateBeans(), this::doWriteRouteTemplateBeanDefinition);
+        endElement();
+    }
+    protected void doWriteRouteTemplateParameterDefinition(
+            String name,
+            RouteTemplateParameterDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("defaultValue", def.getDefaultValue());
+        doWriteAttribute("name", def.getName());
+        doWriteAttribute("description", def.getDescription());
+        doWriteAttribute("required", toString(def.getRequired()));
+        endElement();
+    }
+    protected void doWriteRouteTemplatesDefinition(
+            String name,
+            RouteTemplatesDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getRouteTemplates(), this::doWriteRouteTemplateDefinitionRef);
+        endElement();
+    }
+    protected void doWriteRoutesDefinition(
+            String name,
+            RoutesDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getRoutes(), this::doWriteRouteDefinitionRef);
+        endElement();
+    }
+    protected void doWriteRoutingSlipDefinition(
+            String name,
+            RoutingSlipDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("uriDelimiter", def.getUriDelimiter());
+        doWriteAttribute("ignoreInvalidEndpoints", def.getIgnoreInvalidEndpoints());
+        doWriteAttribute("cacheSize", def.getCacheSize());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteSagaActionUriDefinition(
+            String name,
+            SagaActionUriDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteSendDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteSagaDefinition(
+            String name,
+            SagaDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("propagation", def.getPropagation());
+        doWriteAttribute("completionMode", def.getCompletionMode());
+        doWriteAttribute("sagaService", def.getSagaService());
+        doWriteAttribute("timeout", def.getTimeout());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        doWriteElement("completion", def.getCompletion(), this::doWriteSagaActionUriDefinition);
+        doWriteList(null, "option", def.getOptions(), this::doWritePropertyExpressionDefinition);
+        doWriteElement("compensation", def.getCompensation(), this::doWriteSagaActionUriDefinition);
+        endElement();
+    }
+    protected void doWriteSamplingDefinition(
+            String name,
+            SamplingDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("messageFrequency", def.getMessageFrequency());
+        doWriteAttribute("samplePeriod", def.getSamplePeriod());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteScriptDefinition(
+            String name,
+            ScriptDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    void doWriteSendDefinitionAttributes(
+            SendDefinition<?> def)
+            throws IOException {
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("uri", def.getUri());
+    }
+    void doWriteSendDefinitionElements(SendDefinition<?> def) throws IOException {
+        doWriteOptionalIdentifiedDefinitionElements(def);
+    }
+    protected void doWriteSendDefinition(
+            String name,
+            SendDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteSendDefinitionAttributes(def);
+        doWriteSendDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteSetBodyDefinition(
+            String name,
+            SetBodyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteSetExchangePatternDefinition(
+            String name,
+            SetExchangePatternDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteSetHeaderDefinition(
+            String name,
+            SetHeaderDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("name", def.getName());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteSetPropertyDefinition(
+            String name,
+            SetPropertyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("name", def.getName());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteSortDefinition(
+            String name,
+            SortDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("comparator", def.getComparator());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteSplitDefinition(
+            String name,
+            SplitDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("aggregationStrategy", def.getAggregationStrategy());
+        doWriteAttribute("onPrepare", def.getOnPrepare());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("aggregationStrategyMethodName", def.getAggregationStrategyMethodName());
+        doWriteAttribute("timeout", def.getTimeout());
+        doWriteAttribute("streaming", def.getStreaming());
+        doWriteAttribute("stopOnException", def.getStopOnException());
+        doWriteAttribute("delimiter", def.getDelimiter());
+        doWriteAttribute("parallelProcessing", def.getParallelProcessing());
+        doWriteAttribute("parallelAggregate", def.getParallelAggregate());
+        doWriteAttribute("shareUnitOfWork", def.getShareUnitOfWork());
+        doWriteAttribute("aggregationStrategyMethodAllowNull", def.getAggregationStrategyMethodAllowNull());
+        doWriteOutputExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteStepDefinition(
+            String name,
+            StepDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteStopDefinition(
+            String name,
+            StopDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteTemplatedRouteBeanDefinition(
+            String name,
+            TemplatedRouteBeanDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteBeanFactoryDefinitionAttributes(def);
+        doWriteBeanFactoryDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteTemplatedRouteDefinition(
+            String name,
+            TemplatedRouteDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("routeId", def.getRouteId());
+        doWriteAttribute("routeTemplateRef", def.getRouteTemplateRef());
+        doWriteAttribute("prefixId", def.getPrefixId());
+        doWriteList(null, "bean", def.getBeans(), this::doWriteTemplatedRouteBeanDefinition);
+        doWriteList(null, "parameter", def.getParameters(), this::doWriteTemplatedRouteParameterDefinition);
+        endElement();
+    }
+    protected void doWriteTemplatedRouteParameterDefinition(
+            String name,
+            TemplatedRouteParameterDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("name", def.getName());
+        doWriteAttribute("value", def.getValue());
+        endElement();
+    }
+    protected void doWriteTemplatedRoutesDefinition(
+            String name,
+            TemplatedRoutesDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getTemplatedRoutes(), this::doWriteTemplatedRouteDefinitionRef);
+        endElement();
+    }
+    protected void doWriteThreadPoolProfileDefinition(
+            String name,
+            ThreadPoolProfileDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("keepAliveTime", def.getKeepAliveTime());
+        doWriteAttribute("maxQueueSize", def.getMaxQueueSize());
+        doWriteAttribute("allowCoreThreadTimeOut", def.getAllowCoreThreadTimeOut());
+        doWriteAttribute("poolSize", def.getPoolSize());
+        doWriteAttribute("defaultProfile", def.getDefaultProfile());
+        doWriteAttribute("maxPoolSize", def.getMaxPoolSize());
+        doWriteAttribute("rejectedPolicy", def.getRejectedPolicy());
+        doWriteAttribute("timeUnit", def.getTimeUnit());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteThreadsDefinition(
+            String name,
+            ThreadsDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("keepAliveTime", def.getKeepAliveTime());
+        doWriteAttribute("callerRunsWhenRejected", def.getCallerRunsWhenRejected());
+        doWriteAttribute("maxQueueSize", def.getMaxQueueSize());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("allowCoreThreadTimeOut", def.getAllowCoreThreadTimeOut());
+        doWriteAttribute("poolSize", def.getPoolSize());
+        doWriteAttribute("maxPoolSize", def.getMaxPoolSize());
+        doWriteAttribute("threadName", def.getThreadName());
+        doWriteAttribute("rejectedPolicy", def.getRejectedPolicy());
+        doWriteAttribute("timeUnit", def.getTimeUnit());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteThrottleDefinition(
+            String name,
+            ThrottleDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("timePeriodMillis", def.getTimePeriodMillis());
+        doWriteAttribute("rejectExecution", def.getRejectExecution());
+        doWriteAttribute("callerRunsWhenRejected", def.getCallerRunsWhenRejected());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("asyncDelayed", def.getAsyncDelayed());
+        doWriteExpressionNodeElements(def);
+        doWriteElement("correlationExpression", def.getCorrelationExpression(), this::doWriteExpressionSubElementDefinition);
+        endElement();
+    }
+    protected void doWriteThrowExceptionDefinition(
+            String name,
+            ThrowExceptionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("exceptionType", def.getExceptionType());
+        doWriteAttribute("ref", def.getRef());
+        doWriteAttribute("message", def.getMessage());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteToDefinition(
+            String name,
+            ToDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteSendDefinitionAttributes(def);
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    void doWriteToDynamicDefinitionAttributes(
+            ToDynamicDefinition def)
+            throws IOException {
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("cacheSize", def.getCacheSize());
+        doWriteAttribute("ignoreInvalidEndpoint", def.getIgnoreInvalidEndpoint());
+        doWriteAttribute("autoStartComponents", def.getAutoStartComponents());
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteAttribute("allowOptimisedComponents", def.getAllowOptimisedComponents());
+        doWriteAttribute("uri", def.getUri());
+    }
+    void doWriteToDynamicDefinitionElements(
+            ToDynamicDefinition def)
+            throws IOException {
+        doWriteOptionalIdentifiedDefinitionElements(def);
+    }
+    protected void doWriteToDynamicDefinition(
+            String name,
+            ToDynamicDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteToDynamicDefinitionAttributes(def);
+        doWriteToDynamicDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteTransactedDefinition(
+            String name,
+            TransactedDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteTransformDefinition(
+            String name,
+            TransformDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteTryDefinition(
+            String name,
+            TryDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
+        endElement();
+    }
+    protected void doWriteUnmarshalDefinition(
+            String name,
+            UnmarshalDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("allowNullBody", def.getAllowNullBody());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement(null, def.getDataFormatType(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "ASN1DataFormat" -> doWriteASN1DataFormat("asn1", (ASN1DataFormat) def.getDataFormatType());
+                case "AvroDataFormat" -> doWriteAvroDataFormat("avro", (AvroDataFormat) def.getDataFormatType());
+                case "BarcodeDataFormat" -> doWriteBarcodeDataFormat("barcode", (BarcodeDataFormat) def.getDataFormatType());
+                case "Base64DataFormat" -> doWriteBase64DataFormat("base64", (Base64DataFormat) def.getDataFormatType());
+                case "BindyDataFormat" -> doWriteBindyDataFormat("bindy", (BindyDataFormat) def.getDataFormatType());
+                case "CBORDataFormat" -> doWriteCBORDataFormat("cbor", (CBORDataFormat) def.getDataFormatType());
+                case "CryptoDataFormat" -> doWriteCryptoDataFormat("crypto", (CryptoDataFormat) def.getDataFormatType());
+                case "CsvDataFormat" -> doWriteCsvDataFormat("csv", (CsvDataFormat) def.getDataFormatType());
+                case "CustomDataFormat" -> doWriteCustomDataFormat("custom", (CustomDataFormat) def.getDataFormatType());
+                case "FhirJsonDataFormat" -> doWriteFhirJsonDataFormat("fhirJson", (FhirJsonDataFormat) def.getDataFormatType());
+                case "FhirXmlDataFormat" -> doWriteFhirXmlDataFormat("fhirXml", (FhirXmlDataFormat) def.getDataFormatType());
+                case "FlatpackDataFormat" -> doWriteFlatpackDataFormat("flatpack", (FlatpackDataFormat) def.getDataFormatType());
+                case "GrokDataFormat" -> doWriteGrokDataFormat("grok", (GrokDataFormat) def.getDataFormatType());
+                case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) def.getDataFormatType());
+                case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) def.getDataFormatType());
+                case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) def.getDataFormatType());
+                case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) def.getDataFormatType());
+                case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) def.getDataFormatType());
+                case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) def.getDataFormatType());
+                case "JsonApiDataFormat" -> doWriteJsonApiDataFormat("jsonApi", (JsonApiDataFormat) def.getDataFormatType());
+                case "LZFDataFormat" -> doWriteLZFDataFormat("lzf", (LZFDataFormat) def.getDataFormatType());
+                case "MimeMultipartDataFormat" -> doWriteMimeMultipartDataFormat("mimeMultipart", (MimeMultipartDataFormat) def.getDataFormatType());
+                case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) def.getDataFormatType());
+                case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) def.getDataFormatType());
+                case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) def.getDataFormatType());
+                case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) def.getDataFormatType());
+                case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) def.getDataFormatType());
+                case "SyslogDataFormat" -> doWriteSyslogDataFormat("syslog", (SyslogDataFormat) def.getDataFormatType());
+                case "TarFileDataFormat" -> doWriteTarFileDataFormat("tarFile", (TarFileDataFormat) def.getDataFormatType());
+                case "ThriftDataFormat" -> doWriteThriftDataFormat("thrift", (ThriftDataFormat) def.getDataFormatType());
+                case "TidyMarkupDataFormat" -> doWriteTidyMarkupDataFormat("tidyMarkup", (TidyMarkupDataFormat) def.getDataFormatType());
+                case "UniVocityCsvDataFormat" -> doWriteUniVocityCsvDataFormat("univocityCsv", (UniVocityCsvDataFormat) def.getDataFormatType());
+                case "UniVocityFixedDataFormat" -> doWriteUniVocityFixedDataFormat("univocityFixed", (UniVocityFixedDataFormat) def.getDataFormatType());
+                case "UniVocityTsvDataFormat" -> doWriteUniVocityTsvDataFormat("univocityTsv", (UniVocityTsvDataFormat) def.getDataFormatType());
+                case "XMLSecurityDataFormat" -> doWriteXMLSecurityDataFormat("xmlSecurity", (XMLSecurityDataFormat) def.getDataFormatType());
+                case "PGPDataFormat" -> doWritePGPDataFormat("pgp", (PGPDataFormat) def.getDataFormatType());
+                case "YAMLDataFormat" -> doWriteYAMLDataFormat("yaml", (YAMLDataFormat) def.getDataFormatType());
+                case "ZipDeflaterDataFormat" -> doWriteZipDeflaterDataFormat("zipDeflater", (ZipDeflaterDataFormat) def.getDataFormatType());
+                case "ZipFileDataFormat" -> doWriteZipFileDataFormat("zipFile", (ZipFileDataFormat) def.getDataFormatType());
+            }
+        });
+        endElement();
+    }
+    protected void doWriteValidateDefinition(
+            String name,
+            ValidateDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("predicateExceptionFactory", def.getPredicateExceptionFactory());
+        doWriteExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteValueDefinition(
+            String name,
+            ValueDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteValue(def.getValue());
+        endElement();
+    }
+    protected void doWriteWhenDefinition(
+            String name,
+            WhenDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteOutputExpressionNodeElements(def);
+        endElement();
+    }
+    protected void doWriteWireTapDefinition(
+            String name,
+            WireTapDefinition<?> def)
+            throws IOException {
+        startElement(name);
+        doWriteToDynamicDefinitionAttributes(def);
+        doWriteAttribute("dynamicUri", def.getDynamicUri());
+        doWriteAttribute("onPrepare", def.getOnPrepare());
+        doWriteAttribute("executorService", def.getExecutorService());
+        doWriteAttribute("copy", def.getCopy());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteBlacklistServiceCallServiceFilterConfiguration(
+            String name,
+            BlacklistServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        doWriteList(null, "servers", def.getServers(), this::doWriteString);
+        endElement();
+    }
+    protected void doWriteCachingServiceCallServiceDiscoveryConfiguration(
+            String name,
+            CachingServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("units", def.getUnits());
+        doWriteAttribute("timeout", def.getTimeout());
+        doWriteServiceCallConfigurationElements(def);
+        doWriteElement(null, def.getServiceDiscoveryConfiguration(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "ConsulServiceCallServiceDiscoveryConfiguration" -> doWriteConsulServiceCallServiceDiscoveryConfiguration("consulServiceDiscovery", (ConsulServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "DnsServiceCallServiceDiscoveryConfiguration" -> doWriteDnsServiceCallServiceDiscoveryConfiguration("dnsServiceDiscovery", (DnsServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "KubernetesServiceCallServiceDiscoveryConfiguration" -> doWriteKubernetesServiceCallServiceDiscoveryConfiguration("kubernetesServiceDiscovery", (KubernetesServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "CombinedServiceCallServiceDiscoveryConfiguration" -> doWriteCombinedServiceCallServiceDiscoveryConfiguration("combinedServiceDiscovery", (CombinedServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "StaticServiceCallServiceDiscoveryConfiguration" -> doWriteStaticServiceCallServiceDiscoveryConfiguration("staticServiceDiscovery", (StaticServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+            }
+        });
+        endElement();
+    }
+    protected void doWriteCombinedServiceCallServiceDiscoveryConfiguration(
+            String name,
+            CombinedServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        doWriteList(null, null, def.getServiceDiscoveryConfigurations(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "ConsulServiceCallServiceDiscoveryConfiguration" -> doWriteConsulServiceCallServiceDiscoveryConfiguration("consulServiceDiscovery", (ConsulServiceCallServiceDiscoveryConfiguration) v);
+                case "DnsServiceCallServiceDiscoveryConfiguration" -> doWriteDnsServiceCallServiceDiscoveryConfiguration("dnsServiceDiscovery", (DnsServiceCallServiceDiscoveryConfiguration) v);
+                case "KubernetesServiceCallServiceDiscoveryConfiguration" -> doWriteKubernetesServiceCallServiceDiscoveryConfiguration("kubernetesServiceDiscovery", (KubernetesServiceCallServiceDiscoveryConfiguration) v);
+                case "StaticServiceCallServiceDiscoveryConfiguration" -> doWriteStaticServiceCallServiceDiscoveryConfiguration("staticServiceDiscovery", (StaticServiceCallServiceDiscoveryConfiguration) v);
+                case "CachingServiceCallServiceDiscoveryConfiguration" -> doWriteCachingServiceCallServiceDiscoveryConfiguration("cachingServiceDiscovery", (CachingServiceCallServiceDiscoveryConfiguration) v);
+            }
+        });
+        endElement();
+    }
+    protected void doWriteCombinedServiceCallServiceFilterConfiguration(
+            String name,
+            CombinedServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        doWriteList(null, null, def.getServiceFilterConfigurations(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "BlacklistServiceCallServiceFilterConfiguration" -> doWriteBlacklistServiceCallServiceFilterConfiguration("blacklistServiceFilter", (BlacklistServiceCallServiceFilterConfiguration) v);
+                case "CustomServiceCallServiceFilterConfiguration" -> doWriteCustomServiceCallServiceFilterConfiguration("customServiceFilter", (CustomServiceCallServiceFilterConfiguration) v);
+                case "HealthyServiceCallServiceFilterConfiguration" -> doWriteHealthyServiceCallServiceFilterConfiguration("healthyServiceFilter", (HealthyServiceCallServiceFilterConfiguration) v);
+                case "PassThroughServiceCallServiceFilterConfiguration" -> doWritePassThroughServiceCallServiceFilterConfiguration("passThroughServiceFilter", (PassThroughServiceCallServiceFilterConfiguration) v);
+            }
+        });
+        endElement();
+    }
+    protected void doWriteConsulServiceCallServiceDiscoveryConfiguration(
+            String name,
+            ConsulServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("password", def.getPassword());
+        doWriteAttribute("readTimeoutMillis", def.getReadTimeoutMillis());
+        doWriteAttribute("aclToken", def.getAclToken());
+        doWriteAttribute("connectTimeoutMillis", def.getConnectTimeoutMillis());
+        doWriteAttribute("writeTimeoutMillis", def.getWriteTimeoutMillis());
+        doWriteAttribute("datacenter", def.getDatacenter());
+        doWriteAttribute("userName", def.getUserName());
+        doWriteAttribute("blockSeconds", def.getBlockSeconds());
+        doWriteAttribute("url", def.getUrl());
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteCustomServiceCallServiceFilterConfiguration(
+            String name,
+            CustomServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("ref", def.getServiceFilterRef());
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteDefaultServiceCallServiceLoadBalancerConfiguration(
+            String name,
+            DefaultServiceCallServiceLoadBalancerConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteDnsServiceCallServiceDiscoveryConfiguration(
+            String name,
+            DnsServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("domain", def.getDomain());
+        doWriteAttribute("proto", def.getProto());
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteHealthyServiceCallServiceFilterConfiguration(
+            String name,
+            HealthyServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteKubernetesServiceCallServiceDiscoveryConfiguration(
+            String name,
+            KubernetesServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("lookup", def.getLookup());
+        doWriteAttribute("portProtocol", def.getPortProtocol());
+        doWriteAttribute("caCertData", def.getCaCertData());
+        doWriteAttribute("portName", def.getPortName());
+        doWriteAttribute("oauthToken", def.getOauthToken());
+        doWriteAttribute("clientKeyAlgo", def.getClientKeyAlgo());
+        doWriteAttribute("clientCertFile", def.getClientCertFile());
+        doWriteAttribute("dnsDomain", def.getDnsDomain());
+        doWriteAttribute("password", def.getPassword());
+        doWriteAttribute("apiVersion", def.getApiVersion());
+        doWriteAttribute("clientKeyData", def.getClientKeyData());
+        doWriteAttribute("masterUrl", def.getMasterUrl());
+        doWriteAttribute("namespace", def.getNamespace());
+        doWriteAttribute("clientCertData", def.getClientCertData());
+        doWriteAttribute("clientKeyFile", def.getClientKeyFile());
+        doWriteAttribute("caCertFile", def.getCaCertFile());
+        doWriteAttribute("clientKeyPassphrase", def.getClientKeyPassphrase());
+        doWriteAttribute("trustCerts", def.getTrustCerts());
+        doWriteAttribute("username", def.getUsername());
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWritePassThroughServiceCallServiceFilterConfiguration(
+            String name,
+            PassThroughServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    void doWriteServiceCallConfigurationAttributes(
+            ServiceCallConfiguration def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+    }
+    void doWriteServiceCallConfigurationElements(
+            ServiceCallConfiguration def)
+            throws IOException {
+        doWriteList(null, "properties", def.getProperties(), this::doWritePropertyDefinition);
+    }
+    protected void doWriteServiceCallConfiguration(
+            String name,
+            ServiceCallConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteServiceCallConfigurationAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteServiceCallConfigurationDefinition(
+            String name,
+            ServiceCallConfigurationDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("serviceDiscoveryRef", def.getServiceDiscoveryRef());
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteAttribute("uri", def.getUri());
+        doWriteAttribute("expressionRef", def.getExpressionRef());
+        doWriteAttribute("component", def.getComponent());
+        doWriteAttribute("loadBalancerRef", def.getLoadBalancerRef());
+        doWriteAttribute("serviceFilterRef", def.getServiceFilterRef());
+        doWriteAttribute("serviceChooserRef", def.getServiceChooserRef());
+        doWriteElement(null, def.getServiceFilterConfiguration(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "BlacklistServiceCallServiceFilterConfiguration" -> doWriteBlacklistServiceCallServiceFilterConfiguration("blacklistServiceFilter", (BlacklistServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "CombinedServiceCallServiceFilterConfiguration" -> doWriteCombinedServiceCallServiceFilterConfiguration("combinedServiceFilter", (CombinedServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "CustomServiceCallServiceFilterConfiguration" -> doWriteCustomServiceCallServiceFilterConfiguration("customServiceFilter", (CustomServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "HealthyServiceCallServiceFilterConfiguration" -> doWriteHealthyServiceCallServiceFilterConfiguration("healthyServiceFilter", (HealthyServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "PassThroughServiceCallServiceFilterConfiguration" -> doWritePassThroughServiceCallServiceFilterConfiguration("passThroughServiceFilter", (PassThroughServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+            }
+        });
+        doWriteElement(null, def.getLoadBalancerConfiguration(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "DefaultServiceCallServiceLoadBalancerConfiguration" -> doWriteDefaultServiceCallServiceLoadBalancerConfiguration("defaultLoadBalancer", (DefaultServiceCallServiceLoadBalancerConfiguration) def.getLoadBalancerConfiguration());
+            }
+        });
+        doWriteElement(null, def.getServiceDiscoveryConfiguration(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "CachingServiceCallServiceDiscoveryConfiguration" -> doWriteCachingServiceCallServiceDiscoveryConfiguration("cachingServiceDiscovery", (CachingServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "CombinedServiceCallServiceDiscoveryConfiguration" -> doWriteCombinedServiceCallServiceDiscoveryConfiguration("combinedServiceDiscovery", (CombinedServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "ConsulServiceCallServiceDiscoveryConfiguration" -> doWriteConsulServiceCallServiceDiscoveryConfiguration("consulServiceDiscovery", (ConsulServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "DnsServiceCallServiceDiscoveryConfiguration" -> doWriteDnsServiceCallServiceDiscoveryConfiguration("dnsServiceDiscovery", (DnsServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "KubernetesServiceCallServiceDiscoveryConfiguration" -> doWriteKubernetesServiceCallServiceDiscoveryConfiguration("kubernetesServiceDiscovery", (KubernetesServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "StaticServiceCallServiceDiscoveryConfiguration" -> doWriteStaticServiceCallServiceDiscoveryConfiguration("staticServiceDiscovery", (StaticServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "ZooKeeperServiceCallServiceDiscoveryConfiguration" -> doWriteZooKeeperServiceCallServiceDiscoveryConfiguration("zookeeperServiceDiscovery", (ZooKeeperServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+            }
+        });
+        doWriteElement("expression", def.getExpressionConfiguration(), this::doWriteServiceCallExpressionConfiguration);
+        endElement();
+    }
+    protected void doWriteServiceCallDefinition(
+            String name,
+            ServiceCallDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteProcessorDefinitionAttributes(def);
+        doWriteAttribute("serviceDiscoveryRef", def.getServiceDiscoveryRef());
+        doWriteAttribute("configurationRef", def.getConfigurationRef());
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteAttribute("uri", def.getUri());
+        doWriteAttribute("expressionRef", def.getExpressionRef());
+        doWriteAttribute("component", def.getComponent());
+        doWriteAttribute("loadBalancerRef", def.getLoadBalancerRef());
+        doWriteAttribute("serviceFilterRef", def.getServiceFilterRef());
+        doWriteAttribute("name", def.getName());
+        doWriteAttribute("serviceChooserRef", def.getServiceChooserRef());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteElement(null, def.getServiceFilterConfiguration(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "BlacklistServiceCallServiceFilterConfiguration" -> doWriteBlacklistServiceCallServiceFilterConfiguration("blacklistServiceFilter", (BlacklistServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "CombinedServiceCallServiceFilterConfiguration" -> doWriteCombinedServiceCallServiceFilterConfiguration("combinedServiceFilter", (CombinedServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "CustomServiceCallServiceFilterConfiguration" -> doWriteCustomServiceCallServiceFilterConfiguration("customServiceFilter", (CustomServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "HealthyServiceCallServiceFilterConfiguration" -> doWriteHealthyServiceCallServiceFilterConfiguration("healthyServiceFilter", (HealthyServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+                case "PassThroughServiceCallServiceFilterConfiguration" -> doWritePassThroughServiceCallServiceFilterConfiguration("passThroughServiceFilter", (PassThroughServiceCallServiceFilterConfiguration) def.getServiceFilterConfiguration());
+            }
+        });
+        doWriteElement(null, def.getLoadBalancerConfiguration(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "DefaultServiceCallServiceLoadBalancerConfiguration" -> doWriteDefaultServiceCallServiceLoadBalancerConfiguration("defaultLoadBalancer", (DefaultServiceCallServiceLoadBalancerConfiguration) def.getLoadBalancerConfiguration());
+            }
+        });
+        doWriteElement(null, def.getServiceDiscoveryConfiguration(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "CachingServiceCallServiceDiscoveryConfiguration" -> doWriteCachingServiceCallServiceDiscoveryConfiguration("cachingServiceDiscovery", (CachingServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "CombinedServiceCallServiceDiscoveryConfiguration" -> doWriteCombinedServiceCallServiceDiscoveryConfiguration("combinedServiceDiscovery", (CombinedServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "ConsulServiceCallServiceDiscoveryConfiguration" -> doWriteConsulServiceCallServiceDiscoveryConfiguration("consulServiceDiscovery", (ConsulServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "DnsServiceCallServiceDiscoveryConfiguration" -> doWriteDnsServiceCallServiceDiscoveryConfiguration("dnsServiceDiscovery", (DnsServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "KubernetesServiceCallServiceDiscoveryConfiguration" -> doWriteKubernetesServiceCallServiceDiscoveryConfiguration("kubernetesServiceDiscovery", (KubernetesServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "StaticServiceCallServiceDiscoveryConfiguration" -> doWriteStaticServiceCallServiceDiscoveryConfiguration("staticServiceDiscovery", (StaticServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+                case "ZooKeeperServiceCallServiceDiscoveryConfiguration" -> doWriteZooKeeperServiceCallServiceDiscoveryConfiguration("zookeeperServiceDiscovery", (ZooKeeperServiceCallServiceDiscoveryConfiguration) def.getServiceDiscoveryConfiguration());
+            }
+        });
+        doWriteElement("expression", def.getExpressionConfiguration(), this::doWriteServiceCallExpressionConfiguration);
+        endElement();
+    }
+    protected void doWriteServiceCallExpressionConfiguration(
+            String name,
+            ServiceCallExpressionConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("hostHeader", def.getHostHeader());
+        doWriteAttribute("portHeader", def.getPortHeader());
+        doWriteServiceCallConfigurationElements(def);
+        doWriteElement(null, def.getExpressionType(), this::doWriteExpressionDefinitionRef);
+        endElement();
+    }
+    protected void doWriteServiceCallServiceChooserConfiguration(
+            String name,
+            ServiceCallServiceChooserConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    void doWriteServiceCallServiceDiscoveryConfigurationAttributes(
+            ServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+    }
+    void doWriteServiceCallServiceDiscoveryConfigurationElements(
+            ServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        doWriteServiceCallConfigurationElements(def);
+    }
+    protected void doWriteServiceCallServiceDiscoveryConfiguration(
+            String name,
+            ServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteServiceCallServiceDiscoveryConfigurationAttributes(def);
+        doWriteServiceCallServiceDiscoveryConfigurationElements(def);
+        endElement();
+    }
+    void doWriteServiceCallServiceFilterConfigurationAttributes(
+            ServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+    }
+    void doWriteServiceCallServiceFilterConfigurationElements(
+            ServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        doWriteServiceCallConfigurationElements(def);
+    }
+    protected void doWriteServiceCallServiceFilterConfiguration(
+            String name,
+            ServiceCallServiceFilterConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteServiceCallServiceFilterConfigurationAttributes(def);
+        doWriteServiceCallServiceFilterConfigurationElements(def);
+        endElement();
+    }
+    void doWriteServiceCallServiceLoadBalancerConfigurationAttributes(
+            ServiceCallServiceLoadBalancerConfiguration def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+    }
+    void doWriteServiceCallServiceLoadBalancerConfigurationElements(
+            ServiceCallServiceLoadBalancerConfiguration def)
+            throws IOException {
+        doWriteServiceCallConfigurationElements(def);
+    }
+    protected void doWriteServiceCallServiceLoadBalancerConfiguration(
+            String name,
+            ServiceCallServiceLoadBalancerConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteServiceCallServiceLoadBalancerConfigurationAttributes(def);
+        doWriteServiceCallServiceLoadBalancerConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteStaticServiceCallServiceDiscoveryConfiguration(
+            String name,
+            StaticServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteServiceCallConfigurationElements(def);
+        doWriteList(null, "servers", def.getServers(), this::doWriteString);
+        endElement();
+    }
+    protected void doWriteZooKeeperServiceCallServiceDiscoveryConfiguration(
+            String name,
+            ZooKeeperServiceCallServiceDiscoveryConfiguration def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("reconnectMaxRetries", def.getReconnectMaxRetries());
+        doWriteAttribute("nodes", def.getNodes());
+        doWriteAttribute("basePath", def.getBasePath());
+        doWriteAttribute("reconnectBaseSleepTime", def.getReconnectBaseSleepTime());
+        doWriteAttribute("namespace", def.getNamespace());
+        doWriteAttribute("reconnectMaxSleepTime", def.getReconnectMaxSleepTime());
+        doWriteAttribute("sessionTimeout", def.getSessionTimeout());
+        doWriteAttribute("connectionTimeout", def.getConnectionTimeout());
+        doWriteServiceCallConfigurationElements(def);
+        endElement();
+    }
+    protected void doWriteBatchResequencerConfig(
+            String name,
+            BatchResequencerConfig def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("reverse", def.getReverse());
+        doWriteAttribute("batchSize", def.getBatchSize());
+        doWriteAttribute("allowDuplicates", def.getAllowDuplicates());
+        doWriteAttribute("batchTimeout", def.getBatchTimeout());
+        doWriteAttribute("ignoreInvalidExchanges", def.getIgnoreInvalidExchanges());
+        endElement();
+    }
+    protected void doWriteResequencerConfig(
+            String name,
+            ResequencerConfig def)
+            throws IOException {
+        startElement(name);
+        endElement();
+    }
+    protected void doWriteStreamResequencerConfig(
+            String name,
+            StreamResequencerConfig def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("comparator", def.getComparator());
+        doWriteAttribute("timeout", def.getTimeout());
+        doWriteAttribute("rejectOld", def.getRejectOld());
+        doWriteAttribute("ignoreInvalidExchanges", def.getIgnoreInvalidExchanges());
+        doWriteAttribute("deliveryAttemptInterval", def.getDeliveryAttemptInterval());
+        doWriteAttribute("capacity", def.getCapacity());
+        endElement();
+    }
+    protected void doWriteASN1DataFormat(
+            String name,
+            ASN1DataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("unmarshalType", def.getUnmarshalTypeName());
+        doWriteAttribute("usingIterator", def.getUsingIterator());
+        endElement();
+    }
+    protected void doWriteAvroDataFormat(
+            String name,
+            AvroDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("allowUnmarshallType", def.getAllowUnmarshallType());
+        doWriteAttribute("include", def.getInclude());
+        doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
+        doWriteAttribute("unmarshalType", def.getUnmarshalTypeName());
+        doWriteAttribute("autoDiscoverSchemaResolver", def.getAutoDiscoverSchemaResolver());
+        doWriteAttribute("timezone", def.getTimezone());
+        doWriteAttribute("moduleClassNames", def.getModuleClassNames());
+        doWriteAttribute("instanceClassName", def.getInstanceClassName());
+        doWriteAttribute("collectionType", def.getCollectionTypeName());
+        doWriteAttribute("allowJmsType", def.getAllowJmsType());
+        doWriteAttribute("jsonView", def.getJsonViewTypeName());
+        doWriteAttribute("enableFeatures", def.getEnableFeatures());
+        doWriteAttribute("useList", def.getUseList());
+        doWriteAttribute("disableFeatures", def.getDisableFeatures());
+        doWriteAttribute("moduleRefs", def.getModuleRefs());
+        doWriteAttribute("schemaResolver", def.getSchemaResolver());
+        doWriteAttribute("useDefaultObjectMapper", def.getUseDefaultObjectMapper());
+        doWriteAttribute("objectMapper", def.getObjectMapper());
+        doWriteAttribute("library", toString(def.getLibrary()));
+        doWriteAttribute("autoDiscoverObjectMapper", def.getAutoDiscoverObjectMapper());
+        endElement();
+    }
+    protected void doWriteBarcodeDataFormat(
+            String name,
+            BarcodeDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("barcodeFormat", def.getBarcodeFormat());
+        doWriteAttribute("width", def.getWidth());
+        doWriteAttribute("imageType", def.getImageType());
+        doWriteAttribute("height", def.getHeight());
+        endElement();
+    }
+    protected void doWriteBase64DataFormat(
+            String name,
+            Base64DataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("urlSafe", def.getUrlSafe());
+        doWriteAttribute("lineSeparator", def.getLineSeparator());
+        doWriteAttribute("lineLength", def.getLineLength());
+        endElement();
+    }
+    protected void doWriteBindyDataFormat(
+            String name,
+            BindyDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("unwrapSingleInstance", def.getUnwrapSingleInstance());
+        doWriteAttribute("classType", def.getClassTypeAsString());
+        doWriteAttribute("locale", def.getLocale());
+        doWriteAttribute("type", def.getType());
+        doWriteAttribute("allowEmptyStream", def.getAllowEmptyStream());
+        endElement();
+    }
+    protected void doWriteCBORDataFormat(
+            String name,
+            CBORDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("allowUnmarshallType", def.getAllowUnmarshallType());
+        doWriteAttribute("useDefaultObjectMapper", def.getUseDefaultObjectMapper());
+        doWriteAttribute("prettyPrint", def.getPrettyPrint());
+        doWriteAttribute("objectMapper", def.getObjectMapper());
+        doWriteAttribute("unmarshalType", def.getUnmarshalTypeName());
+        doWriteAttribute("collectionType", def.getCollectionTypeName());
+        doWriteAttribute("allowJmsType", def.getAllowJmsType());
+        doWriteAttribute("enableFeatures", def.getEnableFeatures());
+        doWriteAttribute("useList", def.getUseList());
+        doWriteAttribute("disableFeatures", def.getDisableFeatures());
+        endElement();
+    }
+    protected void doWriteCryptoDataFormat(
+            String name,
+            CryptoDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("shouldAppendHMAC", def.getShouldAppendHMAC());
+        doWriteAttribute("inline", def.getInline());
+        doWriteAttribute("macAlgorithm", def.getMacAlgorithm());
+        doWriteAttribute("algorithmParameterRef", def.getAlgorithmParameterRef());
+        doWriteAttribute("initVectorRef", def.getInitVectorRef());
+        doWriteAttribute("cryptoProvider", def.getCryptoProvider());
+        doWriteAttribute("keyRef", def.getKeyRef());
+        doWriteAttribute("bufferSize", def.getBufferSize());
+        doWriteAttribute("algorithm", def.getAlgorithm());
+        endElement();
+    }
+    protected void doWriteCsvDataFormat(
+            String name,
+            CsvDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("escapeDisabled", def.getEscapeDisabled());
+        doWriteAttribute("recordConverterRef", def.getRecordConverterRef());
+        doWriteAttribute("ignoreEmptyLines", def.getIgnoreEmptyLines());
+        doWriteAttribute("trailingDelimiter", def.getTrailingDelimiter());
+        doWriteAttribute("lazyLoad", def.getLazyLoad());
+        doWriteAttribute("headerDisabled", def.getHeaderDisabled());
+        doWriteAttribute("commentMarkerDisabled", def.getCommentMarkerDisabled());
+        doWriteAttribute("skipHeaderRecord", def.getSkipHeaderRecord());
+        doWriteAttribute("quote", def.getQuote());
+        doWriteAttribute("useMaps", def.getUseMaps());
+        doWriteAttribute("trim", def.getTrim());
+        doWriteAttribute("delimiter", def.getDelimiter());
+        doWriteAttribute("nullString", def.getNullString());
+        doWriteAttribute("allowMissingColumnNames", def.getAllowMissingColumnNames());
+        doWriteAttribute("escape", def.getEscape());
+        doWriteAttribute("nullStringDisabled", def.getNullStringDisabled());
+        doWriteAttribute("commentMarker", def.getCommentMarker());
+        doWriteAttribute("formatRef", def.getFormatRef());
+        doWriteAttribute("quoteMode", def.getQuoteMode());
+        doWriteAttribute("formatName", def.getFormatName());
+        doWriteAttribute("ignoreSurroundingSpaces", def.getIgnoreSurroundingSpaces());
+        doWriteAttribute("quoteDisabled", def.getQuoteDisabled());
+        doWriteAttribute("useOrderedMaps", def.getUseOrderedMaps());
+        doWriteAttribute("ignoreHeaderCase", def.getIgnoreHeaderCase());
+        doWriteAttribute("recordSeparatorDisabled", def.getRecordSeparatorDisabled());
+        doWriteAttribute("captureHeaderRecord", def.getCaptureHeaderRecord());
+        doWriteAttribute("marshallerFactoryRef", def.getMarshallerFactoryRef());
+        doWriteAttribute("recordSeparator", def.getRecordSeparator());
+        doWriteList(null, "header", def.getHeader(), this::doWriteString);
+        endElement();
+    }
+    protected void doWriteCustomDataFormat(
+            String name,
+            CustomDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteDataFormatsDefinition(
+            String name,
+            DataFormatsDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, null, def.getDataFormats(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "ASN1DataFormat" -> doWriteASN1DataFormat("asn1", (ASN1DataFormat) v);
+                case "AvroDataFormat" -> doWriteAvroDataFormat("avro", (AvroDataFormat) v);
+                case "BarcodeDataFormat" -> doWriteBarcodeDataFormat("barcode", (BarcodeDataFormat) v);
+                case "Base64DataFormat" -> doWriteBase64DataFormat("base64", (Base64DataFormat) v);
+                case "BindyDataFormat" -> doWriteBindyDataFormat("bindy", (BindyDataFormat) v);
+                case "CBORDataFormat" -> doWriteCBORDataFormat("cbor", (CBORDataFormat) v);
+                case "CryptoDataFormat" -> doWriteCryptoDataFormat("crypto", (CryptoDataFormat) v);
+                case "CsvDataFormat" -> doWriteCsvDataFormat("csv", (CsvDataFormat) v);
+                case "CustomDataFormat" -> doWriteCustomDataFormat("custom", (CustomDataFormat) v);
+                case "FhirJsonDataFormat" -> doWriteFhirJsonDataFormat("fhirJson", (FhirJsonDataFormat) v);
+                case "FhirXmlDataFormat" -> doWriteFhirXmlDataFormat("fhirXml", (FhirXmlDataFormat) v);
+                case "FlatpackDataFormat" -> doWriteFlatpackDataFormat("flatpack", (FlatpackDataFormat) v);
+                case "GrokDataFormat" -> doWriteGrokDataFormat("grok", (GrokDataFormat) v);
+                case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) v);
+                case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) v);
+                case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) v);
+                case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) v);
+                case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) v);
+                case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) v);
+                case "JsonApiDataFormat" -> doWriteJsonApiDataFormat("jsonApi", (JsonApiDataFormat) v);
+                case "LZFDataFormat" -> doWriteLZFDataFormat("lzf", (LZFDataFormat) v);
+                case "MimeMultipartDataFormat" -> doWriteMimeMultipartDataFormat("mimeMultipart", (MimeMultipartDataFormat) v);
+                case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) v);
+                case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) v);
+                case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) v);
+                case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) v);
+                case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) v);
+                case "SyslogDataFormat" -> doWriteSyslogDataFormat("syslog", (SyslogDataFormat) v);
+                case "TarFileDataFormat" -> doWriteTarFileDataFormat("tarFile", (TarFileDataFormat) v);
+                case "ThriftDataFormat" -> doWriteThriftDataFormat("thrift", (ThriftDataFormat) v);
+                case "TidyMarkupDataFormat" -> doWriteTidyMarkupDataFormat("tidyMarkup", (TidyMarkupDataFormat) v);
+                case "UniVocityCsvDataFormat" -> doWriteUniVocityCsvDataFormat("univocityCsv", (UniVocityCsvDataFormat) v);
+                case "UniVocityFixedDataFormat" -> doWriteUniVocityFixedDataFormat("univocityFixed", (UniVocityFixedDataFormat) v);
+                case "UniVocityTsvDataFormat" -> doWriteUniVocityTsvDataFormat("univocityTsv", (UniVocityTsvDataFormat) v);
+                case "XMLSecurityDataFormat" -> doWriteXMLSecurityDataFormat("xmlSecurity", (XMLSecurityDataFormat) v);
+                case "PGPDataFormat" -> doWritePGPDataFormat("pgp", (PGPDataFormat) v);
+                case "YAMLDataFormat" -> doWriteYAMLDataFormat("yaml", (YAMLDataFormat) v);
+                case "ZipDeflaterDataFormat" -> doWriteZipDeflaterDataFormat("zipDeflater", (ZipDeflaterDataFormat) v);
+                case "ZipFileDataFormat" -> doWriteZipFileDataFormat("zipFile", (ZipFileDataFormat) v);
+            }
+        });
+        endElement();
+    }
+    void doWriteFhirDataformatAttributes(FhirDataformat def) throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
+        doWriteAttribute("dontStripVersionsFromReferencesAtPaths", def.getDontStripVersionsFromReferencesAtPaths());
+        doWriteAttribute("parserOptions", def.getParserOptions());
+        doWriteAttribute("prettyPrint", def.getPrettyPrint());
+        doWriteAttribute("dontEncodeElements", def.getDontEncodeElements());
+        doWriteAttribute("summaryMode", def.getSummaryMode());
+        doWriteAttribute("forceResourceId", def.getForceResourceId());
+        doWriteAttribute("encodeElementsAppliesToChildResourcesOnly", def.getEncodeElementsAppliesToChildResourcesOnly());
+        doWriteAttribute("parserErrorHandler", def.getParserErrorHandler());
+        doWriteAttribute("serverBaseUrl", def.getServerBaseUrl());
+        doWriteAttribute("fhirVersion", def.getFhirVersion());
+        doWriteAttribute("suppressNarratives", def.getSuppressNarratives());
+        doWriteAttribute("fhirContext", def.getFhirContext());
+        doWriteAttribute("stripVersionsFromReferences", def.getStripVersionsFromReferences());
+        doWriteAttribute("encodeElements", def.getEncodeElements());
+        doWriteAttribute("preferTypes", def.getPreferTypes());
+        doWriteAttribute("overrideResourceIdWithBundleEntryFullUrl", def.getOverrideResourceIdWithBundleEntryFullUrl());
+        doWriteAttribute("omitResourceId", def.getOmitResourceId());
+    }
+    protected void doWriteFhirDataformat(
+            String name,
+            FhirDataformat def)
+            throws IOException {
+        startElement(name);
+        doWriteFhirDataformatAttributes(def);
+        endElement();
+    }
+    protected void doWriteFhirJsonDataFormat(
+            String name,
+            FhirJsonDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteFhirDataformatAttributes(def);
+        endElement();
+    }
+    protected void doWriteFhirXmlDataFormat(
+            String name,
+            FhirXmlDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteFhirDataformatAttributes(def);
+        endElement();
+    }
+    protected void doWriteFlatpackDataFormat(
+            String name,
+            FlatpackDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("allowShortLines", def.getAllowShortLines());
+        doWriteAttribute("delimiter", def.getDelimiter());
+        doWriteAttribute("fixed", def.getFixed());
+        doWriteAttribute("definition", def.getDefinition());
+        doWriteAttribute("ignoreFirstRecord", def.getIgnoreFirstRecord());
+        doWriteAttribute("parserFactoryRef", def.getParserFactoryRef());
+        doWriteAttribute("textQualifier", def.getTextQualifier());
+        doWriteAttribute("ignoreExtraColumns", def.getIgnoreExtraColumns());
+        endElement();
+    }
+    protected void doWriteGrokDataFormat(
+            String name,
+            GrokDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("flattened", def.getFlattened());
+        doWriteAttribute("namedOnly", def.getNamedOnly());
+        doWriteAttribute("pattern", def.getPattern());
+        doWriteAttribute("allowMultipleMatchesPerLine", def.getAllowMultipleMatchesPerLine());
+        endElement();
+    }
+    protected void doWriteGzipDeflaterDataFormat(
+            String name,
+            GzipDeflaterDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteHL7DataFormat(
+            String name,
+            HL7DataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("validate", def.getValidate());
+        endElement();
+    }
+    protected void doWriteIcalDataFormat(
+            String name,
+            IcalDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("validating", def.getValidating());
+        endElement();
+    }
+    protected void doWriteJacksonXMLDataFormat(
+            String name,
+            JacksonXMLDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("include", def.getInclude());
+        doWriteAttribute("allowUnmarshallType", def.getAllowUnmarshallType());
+        doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
+        doWriteAttribute("prettyPrint", def.getPrettyPrint());
+        doWriteAttribute("unmarshalType", def.getUnmarshalTypeName());
+        doWriteAttribute("timezone", def.getTimezone());
+        doWriteAttribute("moduleClassNames", def.getModuleClassNames());
+        doWriteAttribute("collectionType", def.getCollectionTypeName());
+        doWriteAttribute("allowJmsType", def.getAllowJmsType());
+        doWriteAttribute("jsonView", def.getJsonViewTypeName());
+        doWriteAttribute("enableFeatures", def.getEnableFeatures());
+        doWriteAttribute("useList", def.getUseList());
+        doWriteAttribute("disableFeatures", def.getDisableFeatures());
+        doWriteAttribute("moduleRefs", def.getModuleRefs());
+        doWriteAttribute("enableJaxbAnnotationModule", def.getEnableJaxbAnnotationModule());
+        doWriteAttribute("xmlMapper", def.getXmlMapper());
+        endElement();
+    }
+    protected void doWriteJaxbDataFormat(
+            String name,
+            JaxbDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("accessExternalSchemaProtocols", def.getAccessExternalSchemaProtocols());
+        doWriteAttribute("schema", def.getSchema());
+        doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
+        doWriteAttribute("prettyPrint", def.getPrettyPrint());
+        doWriteAttribute("schemaLocation", def.getSchemaLocation());
+        doWriteAttribute("contextPathIsClassName", def.getContextPathIsClassName());
+        doWriteAttribute("ignoreJAXBElement", def.getIgnoreJAXBElement());
+        doWriteAttribute("xmlStreamWriterWrapper", def.getXmlStreamWriterWrapper());
+        doWriteAttribute("schemaSeverityLevel", def.getSchemaSeverityLevel());
+        doWriteAttribute("contextPath", def.getContextPath());
+        doWriteAttribute("noNamespaceSchemaLocation", def.getNoNamespaceSchemaLocation());
+        doWriteAttribute("encoding", def.getEncoding());
+        doWriteAttribute("fragment", def.getFragment());
+        doWriteAttribute("filterNonXmlChars", def.getFilterNonXmlChars());
+        doWriteAttribute("mustBeJAXBElement", def.getMustBeJAXBElement());
+        doWriteAttribute("objectFactory", def.getObjectFactory());
+        doWriteAttribute("namespacePrefixRef", def.getNamespacePrefixRef());
+        doWriteAttribute("partClass", def.getPartClass());
+        doWriteAttribute("jaxbProviderProperties", def.getJaxbProviderProperties());
+        doWriteAttribute("partNamespace", def.getPartNamespace());
+        endElement();
+    }
+    protected void doWriteJsonApiDataFormat(
+            String name,
+            JsonApiDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("dataFormatTypes", def.getDataFormatTypes());
+        doWriteAttribute("mainFormatType", def.getMainFormatType());
+        endElement();
+    }
+    protected void doWriteJsonDataFormat(
+            String name,
+            JsonDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("dateFormatPattern", def.getDateFormatPattern());
+        doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
+        doWriteAttribute("timezone", def.getTimezone());
+        doWriteAttribute("moduleClassNames", def.getModuleClassNames());
+        doWriteAttribute("collectionType", def.getCollectionTypeName());
+        doWriteAttribute("allowJmsType", def.getAllowJmsType());
+        doWriteAttribute("jsonView", def.getJsonViewTypeName());
+        doWriteAttribute("enableFeatures", def.getEnableFeatures());
+        doWriteAttribute("library", toString(def.getLibrary()));
+        doWriteAttribute("autoDiscoverObjectMapper", def.getAutoDiscoverObjectMapper());
+        doWriteAttribute("allowUnmarshallType", def.getAllowUnmarshallType());
+        doWriteAttribute("include", def.getInclude());
+        doWriteAttribute("prettyPrint", def.getPrettyPrint());
+        doWriteAttribute("unmarshalType", def.getUnmarshalTypeName());
+        doWriteAttribute("autoDiscoverSchemaResolver", def.getAutoDiscoverSchemaResolver());
+        doWriteAttribute("useList", def.getUseList());
+        doWriteAttribute("disableFeatures", def.getDisableFeatures());
+        doWriteAttribute("moduleRefs", def.getModuleRefs());
+        doWriteAttribute("schemaResolver", def.getSchemaResolver());
+        doWriteAttribute("useDefaultObjectMapper", def.getUseDefaultObjectMapper());
+        doWriteAttribute("objectMapper", def.getObjectMapper());
+        doWriteAttribute("namingStrategy", def.getNamingStrategy());
+        endElement();
+    }
+    protected void doWriteLZFDataFormat(
+            String name,
+            LZFDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("usingParallelCompression", def.getUsingParallelCompression());
+        endElement();
+    }
+    protected void doWriteMimeMultipartDataFormat(
+            String name,
+            MimeMultipartDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("headersInline", def.getHeadersInline());
+        doWriteAttribute("multipartWithoutAttachment", def.getMultipartWithoutAttachment());
+        doWriteAttribute("multipartSubType", def.getMultipartSubType());
+        doWriteAttribute("includeHeaders", def.getIncludeHeaders());
+        doWriteAttribute("binaryContent", def.getBinaryContent());
+        endElement();
+    }
+    protected void doWritePGPDataFormat(
+            String name,
+            PGPDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("armored", def.getArmored());
+        doWriteAttribute("signaturePassword", def.getSignaturePassword());
+        doWriteAttribute("signatureKeyRing", def.getSignatureKeyRing());
+        doWriteAttribute("signatureVerificationOption", def.getSignatureVerificationOption());
+        doWriteAttribute("keyFileName", def.getKeyFileName());
+        doWriteAttribute("signatureKeyUserid", def.getSignatureKeyUserid());
+        doWriteAttribute("integrity", def.getIntegrity());
+        doWriteAttribute("password", def.getPassword());
+        doWriteAttribute("provider", def.getProvider());
+        doWriteAttribute("compressionAlgorithm", def.getCompressionAlgorithm());
+        doWriteAttribute("keyUserid", def.getKeyUserid());
+        doWriteAttribute("signatureKeyFileName", def.getSignatureKeyFileName());
+        doWriteAttribute("hashAlgorithm", def.getHashAlgorithm());
+        doWriteAttribute("algorithm", def.getAlgorithm());
+        endElement();
+    }
+    protected void doWriteProtobufDataFormat(
+            String name,
+            ProtobufDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
+        doWriteAttribute("contentTypeFormat", def.getContentTypeFormat());
+        doWriteAttribute("timezone", def.getTimezone());
+        doWriteAttribute("moduleClassNames", def.getModuleClassNames());
+        doWriteAttribute("collectionType", def.getCollectionTypeName());
+        doWriteAttribute("allowJmsType", def.getAllowJmsType());
+        doWriteAttribute("jsonView", def.getJsonViewTypeName());
+        doWriteAttribute("enableFeatures", def.getEnableFeatures());
+        doWriteAttribute("library", toString(def.getLibrary()));
+        doWriteAttribute("autoDiscoverObjectMapper", def.getAutoDiscoverObjectMapper());
+        doWriteAttribute("allowUnmarshallType", def.getAllowUnmarshallType());
+        doWriteAttribute("include", def.getInclude());
+        doWriteAttribute("unmarshalType", def.getUnmarshalTypeName());
+        doWriteAttribute("autoDiscoverSchemaResolver", def.getAutoDiscoverSchemaResolver());
+        doWriteAttribute("instanceClass", def.getInstanceClass());
+        doWriteAttribute("useList", def.getUseList());
+        doWriteAttribute("disableFeatures", def.getDisableFeatures());
+        doWriteAttribute("moduleRefs", def.getModuleRefs());
+        doWriteAttribute("schemaResolver", def.getSchemaResolver());
+        doWriteAttribute("useDefaultObjectMapper", def.getUseDefaultObjectMapper());
+        doWriteAttribute("objectMapper", def.getObjectMapper());
+        endElement();
+    }
+    protected void doWriteRssDataFormat(
+            String name,
+            RssDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteSoapDataFormat(
+            String name,
+            SoapDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("schema", def.getSchema());
+        doWriteAttribute("namespacePrefixRef", def.getNamespacePrefixRef());
+        doWriteAttribute("elementNameStrategyRef", def.getElementNameStrategyRef());
+        doWriteAttribute("contextPath", def.getContextPath());
+        doWriteAttribute("encoding", def.getEncoding());
+        doWriteAttribute("version", def.getVersion());
+        endElement();
+    }
+    protected void doWriteSwiftMtDataFormat(
+            String name,
+            SwiftMtDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("writeInJson", def.getWriteInJson());
+        endElement();
+    }
+    protected void doWriteSwiftMxDataFormat(
+            String name,
+            SwiftMxDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("readMessageId", def.getReadMessageId());
+        doWriteAttribute("writeInJson", def.getWriteInJson());
+        doWriteAttribute("writeConfigRef", def.getWriteConfigRef());
+        doWriteAttribute("readConfigRef", def.getReadConfigRef());
+        endElement();
+    }
+    protected void doWriteSyslogDataFormat(
+            String name,
+            SyslogDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteTarFileDataFormat(
+            String name,
+            TarFileDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("maxDecompressedSize", def.getMaxDecompressedSize());
+        doWriteAttribute("usingIterator", def.getUsingIterator());
+        doWriteAttribute("preservePathElements", def.getPreservePathElements());
+        doWriteAttribute("allowEmptyDirectory", def.getAllowEmptyDirectory());
+        endElement();
+    }
+    protected void doWriteThriftDataFormat(
+            String name,
+            ThriftDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
+        doWriteAttribute("contentTypeFormat", def.getContentTypeFormat());
+        doWriteAttribute("instanceClass", def.getInstanceClass());
+        endElement();
+    }
+    protected void doWriteTidyMarkupDataFormat(
+            String name,
+            TidyMarkupDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("omitXmlDeclaration", def.getOmitXmlDeclaration());
+        doWriteAttribute("dataObjectType", def.getDataObjectTypeName());
+        endElement();
+    }
+    void doWriteUniVocityAbstractDataFormatAttributes(
+            UniVocityAbstractDataFormat def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("headerExtractionEnabled", def.getHeaderExtractionEnabled());
+        doWriteAttribute("skipEmptyLines", def.getSkipEmptyLines());
+        doWriteAttribute("asMap", def.getAsMap());
+        doWriteAttribute("ignoreLeadingWhitespaces", def.getIgnoreLeadingWhitespaces());
+        doWriteAttribute("lineSeparator", def.getLineSeparator());
+        doWriteAttribute("ignoreTrailingWhitespaces", def.getIgnoreTrailingWhitespaces());
+        doWriteAttribute("lazyLoad", def.getLazyLoad());
+        doWriteAttribute("nullValue", def.getNullValue());
+        doWriteAttribute("normalizedLineSeparator", def.getNormalizedLineSeparator());
+        doWriteAttribute("emptyValue", def.getEmptyValue());
+        doWriteAttribute("headersDisabled", def.getHeadersDisabled());
+        doWriteAttribute("comment", def.getComment());
+        doWriteAttribute("numberOfRecordsToRead", def.getNumberOfRecordsToRead());
+    }
+    void doWriteUniVocityAbstractDataFormatElements(
+            UniVocityAbstractDataFormat def)
+            throws IOException {
+        doWriteList(null, null, def.getHeaders(), this::doWriteUniVocityHeaderRef);
+    }
+    protected void doWriteUniVocityAbstractDataFormat(
+            String name,
+            UniVocityAbstractDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteUniVocityAbstractDataFormatAttributes(def);
+        doWriteUniVocityAbstractDataFormatElements(def);
+        endElement();
+    }
+    protected void doWriteUniVocityCsvDataFormat(
+            String name,
+            UniVocityCsvDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteUniVocityAbstractDataFormatAttributes(def);
+        doWriteAttribute("quoteEscape", def.getQuoteEscape());
+        doWriteAttribute("quote", def.getQuote());
+        doWriteAttribute("delimiter", def.getDelimiter());
+        doWriteAttribute("quoteAllFields", def.getQuoteAllFields());
+        doWriteUniVocityAbstractDataFormatElements(def);
+        endElement();
+    }
+    protected void doWriteUniVocityFixedDataFormat(
+            String name,
+            UniVocityFixedDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteUniVocityAbstractDataFormatAttributes(def);
+        doWriteAttribute("recordEndsOnNewline", def.getRecordEndsOnNewline());
+        doWriteAttribute("padding", def.getPadding());
+        doWriteAttribute("skipTrailingCharsUntilNewline", def.getSkipTrailingCharsUntilNewline());
+        doWriteUniVocityAbstractDataFormatElements(def);
+        endElement();
+    }
+    protected void doWriteUniVocityHeader(
+            String name,
+            UniVocityHeader def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("length", def.getLength());
+        doWriteValue(def.getName());
+        endElement();
+    }
+    protected void doWriteUniVocityTsvDataFormat(
+            String name,
+            UniVocityTsvDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteUniVocityAbstractDataFormatAttributes(def);
+        doWriteAttribute("escapeChar", def.getEscapeChar());
+        doWriteUniVocityAbstractDataFormatElements(def);
+        endElement();
+    }
+    protected void doWriteXMLSecurityDataFormat(
+            String name,
+            XMLSecurityDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("addKeyValueForEncryptedKey", def.getAddKeyValueForEncryptedKey());
+        doWriteAttribute("keyCipherAlgorithm", def.getKeyCipherAlgorithm());
+        doWriteAttribute("recipientKeyAlias", def.getRecipientKeyAlias());
+        doWriteAttribute("keyOrTrustStoreParametersRef", def.getKeyOrTrustStoreParametersRef());
+        doWriteAttribute("digestAlgorithm", def.getDigestAlgorithm());
+        doWriteAttribute("mgfAlgorithm", def.getMgfAlgorithm());
+        doWriteAttribute("secureTagContents", def.getSecureTagContents());
+        doWriteAttribute("passPhraseByte", toString(def.getPassPhraseByte()));
+        doWriteAttribute("keyPassword", def.getKeyPassword());
+        doWriteAttribute("secureTag", def.getSecureTag());
+        doWriteAttribute("xmlCipherAlgorithm", def.getXmlCipherAlgorithm());
+        doWriteAttribute("passPhrase", def.getPassPhrase());
+        endElement();
+    }
+    protected void doWriteYAMLDataFormat(
+            String name,
+            YAMLDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("resolver", def.getResolver());
+        doWriteAttribute("unmarshalType", def.getUnmarshalTypeName());
+        doWriteAttribute("prettyFlow", def.getPrettyFlow());
+        doWriteAttribute("allowAnyType", def.getAllowAnyType());
+        doWriteAttribute("representer", def.getRepresenter());
+        doWriteAttribute("constructor", def.getConstructor());
+        doWriteAttribute("library", toString(def.getLibrary()));
+        doWriteAttribute("maxAliasesForCollections", def.getMaxAliasesForCollections());
+        doWriteAttribute("dumperOptions", def.getDumperOptions());
+        doWriteAttribute("useApplicationContextClassLoader", def.getUseApplicationContextClassLoader());
+        doWriteAttribute("allowRecursiveKeys", def.getAllowRecursiveKeys());
+        doWriteList(null, "typeFilter", def.getTypeFilters(), this::doWriteYAMLTypeFilterDefinition);
+        endElement();
+    }
+    protected void doWriteYAMLTypeFilterDefinition(
+            String name,
+            YAMLTypeFilterDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("type", def.getType());
+        doWriteAttribute("value", def.getValue());
+        endElement();
+    }
+    protected void doWriteZipDeflaterDataFormat(
+            String name,
+            ZipDeflaterDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("compressionLevel", def.getCompressionLevel());
+        endElement();
+    }
+    protected void doWriteZipFileDataFormat(
+            String name,
+            ZipFileDataFormat def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("maxDecompressedSize", def.getMaxDecompressedSize());
+        doWriteAttribute("usingIterator", def.getUsingIterator());
+        doWriteAttribute("preservePathElements", def.getPreservePathElements());
+        doWriteAttribute("allowEmptyDirectory", def.getAllowEmptyDirectory());
+        endElement();
+    }
+    protected void doWriteDeadLetterChannelDefinition(
+            String name,
+            DeadLetterChannelDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteDefaultErrorHandlerDefinitionAttributes(def);
+        doWriteAttribute("deadLetterHandleNewException", def.getDeadLetterHandleNewException());
+        doWriteAttribute("deadLetterUri", def.getDeadLetterUri());
+        doWriteDefaultErrorHandlerDefinitionElements(def);
+        endElement();
+    }
+    void doWriteDefaultErrorHandlerDefinitionAttributes(
+            DefaultErrorHandlerDefinition def)
+            throws IOException {
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("executorServiceRef", def.getExecutorServiceRef());
+        doWriteAttribute("level", def.getLevel());
+        doWriteAttribute("loggerRef", def.getLoggerRef());
+        doWriteAttribute("useOriginalMessage", def.getUseOriginalMessage());
+        doWriteAttribute("onRedeliveryRef", def.getOnRedeliveryRef());
+        doWriteAttribute("retryWhileRef", def.getRetryWhileRef());
+        doWriteAttribute("logName", def.getLogName());
+        doWriteAttribute("useOriginalBody", def.getUseOriginalBody());
+        doWriteAttribute("onPrepareFailureRef", def.getOnPrepareFailureRef());
+        doWriteAttribute("onExceptionOccurredRef", def.getOnExceptionOccurredRef());
+        doWriteAttribute("redeliveryPolicyRef", def.getRedeliveryPolicyRef());
+    }
+    void doWriteDefaultErrorHandlerDefinitionElements(
+            DefaultErrorHandlerDefinition def)
+            throws IOException {
+        doWriteElement("redeliveryPolicy", def.getRedeliveryPolicy(), this::doWriteRedeliveryPolicyDefinition);
+    }
+    protected void doWriteDefaultErrorHandlerDefinition(
+            String name,
+            DefaultErrorHandlerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteDefaultErrorHandlerDefinitionAttributes(def);
+        doWriteDefaultErrorHandlerDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteJtaTransactionErrorHandlerDefinition(
+            String name,
+            JtaTransactionErrorHandlerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTransactionErrorHandlerDefinitionAttributes(def);
+        doWriteDefaultErrorHandlerDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteNoErrorHandlerDefinition(
+            String name,
+            NoErrorHandlerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteRefErrorHandlerDefinition(
+            String name,
+            RefErrorHandlerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteSpringTransactionErrorHandlerDefinition(
+            String name,
+            SpringTransactionErrorHandlerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTransactionErrorHandlerDefinitionAttributes(def);
+        doWriteDefaultErrorHandlerDefinitionElements(def);
+        endElement();
+    }
+    void doWriteTransactionErrorHandlerDefinitionAttributes(
+            TransactionErrorHandlerDefinition def)
+            throws IOException {
+        doWriteDefaultErrorHandlerDefinitionAttributes(def);
+        doWriteAttribute("rollbackLoggingLevel", def.getRollbackLoggingLevel());
+        doWriteAttribute("transactedPolicyRef", def.getTransactedPolicyRef());
+    }
+    void doWriteTransactionErrorHandlerDefinitionElements(
+            TransactionErrorHandlerDefinition def)
+            throws IOException {
+        doWriteDefaultErrorHandlerDefinitionElements(def);
+    }
+    protected void doWriteTransactionErrorHandlerDefinition(
+            String name,
+            TransactionErrorHandlerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTransactionErrorHandlerDefinitionAttributes(def);
+        doWriteTransactionErrorHandlerDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteCSimpleExpression(
+            String name,
+            CSimpleExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteConstantExpression(
+            String name,
+            ConstantExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteDatasonnetExpression(
+            String name,
+            DatasonnetExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteAttribute("outputMediaType", def.getOutputMediaType());
+        doWriteAttribute("bodyMediaType", def.getBodyMediaType());
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteExchangePropertyExpression(
+            String name,
+            ExchangePropertyExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    void doWriteExpressionDefinitionAttributes(
+            ExpressionDefinition def)
+            throws IOException {
+        doWriteAttribute("trim", def.getTrim());
+        doWriteAttribute("id", def.getId());
+    }
+    protected void doWriteExpressionDefinition(
+            String name,
+            ExpressionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteGroovyExpression(
+            String name,
+            GroovyExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteHeaderExpression(
+            String name,
+            HeaderExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteHl7TerserExpression(
+            String name,
+            Hl7TerserExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteJavaScriptExpression(
+            String name,
+            JavaScriptExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteJoorExpression(
+            String name,
+            JoorExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteAttribute("preCompile", def.getPreCompile());
+        doWriteAttribute("singleQuotes", def.getSingleQuotes());
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteJqExpression(
+            String name,
+            JqExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteJsonPathExpression(
+            String name,
+            JsonPathExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputTypedExpressionDefinitionAttributes(def);
+        doWriteAttribute("unpackArray", def.getUnpackArray());
+        doWriteAttribute("writeAsString", def.getWriteAsString());
+        doWriteAttribute("allowSimple", def.getAllowSimple());
+        doWriteAttribute("suppressExceptions", def.getSuppressExceptions());
+        doWriteAttribute("allowEasyPredicate", def.getAllowEasyPredicate());
+        doWriteAttribute("option", def.getOption());
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteLanguageExpression(
+            String name,
+            LanguageExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteExpressionDefinitionAttributes(def);
+        doWriteAttribute("language", def.getLanguage());
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteMethodCallExpression(
+            String name,
+            MethodCallExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteAttribute("method", def.getMethod());
+        doWriteAttribute("scope", def.getScope());
+        doWriteAttribute("beanType", def.getBeanTypeName());
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteMvelExpression(
+            String name,
+            MvelExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    void doWriteNamespaceAwareExpressionAttributes(
+            NamespaceAwareExpression def)
+            throws IOException {
+        doWriteSingleInputExpressionDefinitionAttributes(def);
+    }
+    void doWriteNamespaceAwareExpressionElements(
+            NamespaceAwareExpression def)
+            throws IOException {
+        doWriteList(null, "namespace", def.getNamespace(), this::doWritePropertyDefinition);
+    }
+    protected void doWriteNamespaceAwareExpression(
+            String name,
+            NamespaceAwareExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteNamespaceAwareExpressionAttributes(def);
+        doWriteValue(def.getExpression());
+        doWriteNamespaceAwareExpressionElements(def);
+        endElement();
+    }
+    protected void doWriteOgnlExpression(
+            String name,
+            OgnlExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWritePythonExpression(
+            String name,
+            PythonExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteRefExpression(
+            String name,
+            RefExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteSimpleExpression(
+            String name,
+            SimpleExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    void doWriteSingleInputExpressionDefinitionAttributes(
+            SingleInputExpressionDefinition def)
+            throws IOException {
+        doWriteExpressionDefinitionAttributes(def);
+        doWriteAttribute("headerName", def.getHeaderName());
+        doWriteAttribute("propertyName", def.getPropertyName());
+    }
+    protected void doWriteSingleInputExpressionDefinition(
+            String name,
+            SingleInputExpressionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    void doWriteSingleInputTypedExpressionDefinitionAttributes(
+            SingleInputTypedExpressionDefinition def)
+            throws IOException {
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteAttribute("headerName", def.getHeaderName());
+        doWriteAttribute("propertyName", def.getPropertyName());
+    }
+    protected void doWriteSingleInputTypedExpressionDefinition(
+            String name,
+            SingleInputTypedExpressionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteSpELExpression(
+            String name,
+            SpELExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteTokenizerExpression(
+            String name,
+            TokenizerExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputExpressionDefinitionAttributes(def);
+        doWriteAttribute("regex", def.getRegex());
+        doWriteAttribute("endToken", def.getEndToken());
+        doWriteAttribute("includeTokens", def.getIncludeTokens());
+        doWriteAttribute("skipFirst", def.getSkipFirst());
+        doWriteAttribute("xml", def.getXml());
+        doWriteAttribute("inheritNamespaceTagName", def.getInheritNamespaceTagName());
+        doWriteAttribute("groupDelimiter", def.getGroupDelimiter());
+        doWriteAttribute("group", def.getGroup());
+        doWriteAttribute("token", def.getToken());
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    void doWriteTypedExpressionDefinitionAttributes(
+            TypedExpressionDefinition def)
+            throws IOException {
+        doWriteExpressionDefinitionAttributes(def);
+        doWriteAttribute("resultType", def.getResultTypeName());
+    }
+    protected void doWriteTypedExpressionDefinition(
+            String name,
+            TypedExpressionDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTypedExpressionDefinitionAttributes(def);
+        doWriteValue(def.getExpression());
+        endElement();
+    }
+    protected void doWriteXMLTokenizerExpression(
+            String name,
+            XMLTokenizerExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputExpressionDefinitionAttributes(def);
+        doWriteAttribute("mode", def.getMode());
+        doWriteAttribute("group", def.getGroup());
+        doWriteValue(def.getExpression());
+        doWriteNamespaceAwareExpressionElements(def);
+        endElement();
+    }
+    protected void doWriteXPathExpression(
+            String name,
+            XPathExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputExpressionDefinitionAttributes(def);
+        doWriteAttribute("preCompile", def.getPreCompile());
+        doWriteAttribute("objectModel", def.getObjectModel());
+        doWriteAttribute("logNamespaces", def.getLogNamespaces());
+        doWriteAttribute("threadSafety", def.getThreadSafety());
+        doWriteAttribute("factoryRef", def.getFactoryRef());
+        doWriteAttribute("saxon", def.getSaxon());
+        doWriteAttribute("documentType", def.getDocumentTypeName());
+        doWriteAttribute("resultType", def.getResultTypeName());
+        doWriteValue(def.getExpression());
+        doWriteNamespaceAwareExpressionElements(def);
+        endElement();
+    }
+    protected void doWriteXQueryExpression(
+            String name,
+            XQueryExpression def)
+            throws IOException {
+        startElement(name);
+        doWriteSingleInputExpressionDefinitionAttributes(def);
+        doWriteAttribute("configurationRef", def.getConfigurationRef());
+        doWriteAttribute("type", def.getType());
+        doWriteAttribute("resultType", def.getResultTypeName());
+        doWriteValue(def.getExpression());
+        doWriteNamespaceAwareExpressionElements(def);
+        endElement();
+    }
+    protected void doWriteCustomLoadBalancerDefinition(
+            String name,
+            CustomLoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        endElement();
+    }
+    protected void doWriteFailoverLoadBalancerDefinition(
+            String name,
+            FailoverLoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("sticky", def.getSticky());
+        doWriteAttribute("maximumFailoverAttempts", def.getMaximumFailoverAttempts());
+        doWriteAttribute("roundRobin", def.getRoundRobin());
+        doWriteList(null, "exception", def.getExceptions(), this::doWriteString);
+        endElement();
+    }
+    protected void doWriteRandomLoadBalancerDefinition(
+            String name,
+            RandomLoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteRoundRobinLoadBalancerDefinition(
+            String name,
+            RoundRobinLoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteStickyLoadBalancerDefinition(
+            String name,
+            StickyLoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteElement("correlationExpression", def.getCorrelationExpression(), this::doWriteExpressionSubElementDefinition);
+        endElement();
+    }
+    protected void doWriteTopicLoadBalancerDefinition(
+            String name,
+            TopicLoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        endElement();
+    }
+    protected void doWriteWeightedLoadBalancerDefinition(
+            String name,
+            WeightedLoadBalancerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteIdentifiedTypeAttributes(def);
+        doWriteAttribute("distributionRatioDelimiter", def.getDistributionRatioDelimiter());
+        doWriteAttribute("distributionRatio", def.getDistributionRatio());
+        doWriteAttribute("roundRobin", def.getRoundRobin());
+        endElement();
+    }
+    protected void doWriteApiKeyDefinition(
+            String name,
+            ApiKeyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteRestSecurityDefinitionAttributes(def);
+        doWriteAttribute("inHeader", def.getInHeader());
+        doWriteAttribute("inCookie", def.getInCookie());
+        doWriteAttribute("name", def.getName());
+        doWriteAttribute("inQuery", def.getInQuery());
+        endElement();
+    }
+    protected void doWriteBasicAuthDefinition(
+            String name,
+            BasicAuthDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteRestSecurityDefinitionAttributes(def);
+        endElement();
+    }
+    protected void doWriteBearerTokenDefinition(
+            String name,
+            BearerTokenDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteRestSecurityDefinitionAttributes(def);
+        doWriteAttribute("format", def.getFormat());
+        endElement();
+    }
+    protected void doWriteDeleteDefinition(
+            String name,
+            DeleteDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteVerbDefinitionAttributes(def);
+        doWriteVerbDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteGetDefinition(
+            String name,
+            GetDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteVerbDefinitionAttributes(def);
+        doWriteVerbDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteHeadDefinition(
+            String name,
+            HeadDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteVerbDefinitionAttributes(def);
+        doWriteVerbDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteMutualTLSDefinition(
+            String name,
+            MutualTLSDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteRestSecurityDefinitionAttributes(def);
+        endElement();
+    }
+    protected void doWriteOAuth2Definition(
+            String name,
+            OAuth2Definition def)
+            throws IOException {
+        startElement(name);
+        doWriteRestSecurityDefinitionAttributes(def);
+        doWriteAttribute("tokenUrl", def.getTokenUrl());
+        doWriteAttribute("authorizationUrl", def.getAuthorizationUrl());
+        doWriteAttribute("refreshUrl", def.getRefreshUrl());
+        doWriteAttribute("flow", def.getFlow());
+        doWriteList(null, "scopes", def.getScopes(), this::doWriteRestPropertyDefinition);
+        endElement();
+    }
+    protected void doWriteOpenIdConnectDefinition(
+            String name,
+            OpenIdConnectDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteRestSecurityDefinitionAttributes(def);
+        doWriteAttribute("url", def.getUrl());
+        endElement();
+    }
+    protected void doWriteParamDefinition(
+            String name,
+            ParamDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("arrayType", def.getArrayType());
+        doWriteAttribute("dataFormat", def.getDataFormat());
+        doWriteAttribute("defaultValue", def.getDefaultValue());
+        doWriteAttribute("dataType", def.getDataType());
+        doWriteAttribute("name", def.getName());
+        doWriteAttribute("description", def.getDescription());
+        doWriteAttribute("type", toString(def.getType()));
+        doWriteAttribute("collectionFormat", toString(def.getCollectionFormat()));
+        doWriteAttribute("required", toString(def.getRequired()));
+        doWriteList("allowableValues", "value", def.getAllowableValues(), this::doWriteValueDefinition);
+        doWriteList(null, "examples", def.getExamples(), this::doWriteRestPropertyDefinition);
+        endElement();
+    }
+    protected void doWritePatchDefinition(
+            String name,
+            PatchDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteVerbDefinitionAttributes(def);
+        doWriteVerbDefinitionElements(def);
+        endElement();
+    }
+    protected void doWritePostDefinition(
+            String name,
+            PostDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteVerbDefinitionAttributes(def);
+        doWriteVerbDefinitionElements(def);
+        endElement();
+    }
+    protected void doWritePutDefinition(
+            String name,
+            PutDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteVerbDefinitionAttributes(def);
+        doWriteVerbDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteResponseHeaderDefinition(
+            String name,
+            ResponseHeaderDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("arrayType", def.getArrayType());
+        doWriteAttribute("dataFormat", def.getDataFormat());
+        doWriteAttribute("dataType", def.getDataType());
+        doWriteAttribute("name", def.getName());
+        doWriteAttribute("description", def.getDescription());
+        doWriteAttribute("collectionFormat", toString(def.getCollectionFormat()));
+        doWriteAttribute("example", def.getExample());
+        doWriteList("allowableValues", "value", def.getAllowableValues(), this::doWriteValueDefinition);
+        endElement();
+    }
+    protected void doWriteResponseMessageDefinition(
+            String name,
+            ResponseMessageDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("code", def.getCode());
+        doWriteAttribute("responseModel", def.getResponseModel());
+        doWriteAttribute("message", def.getMessage());
+        doWriteList(null, "header", def.getHeaders(), this::doWriteResponseHeaderDefinition);
+        doWriteList(null, "examples", def.getExamples(), this::doWriteRestPropertyDefinition);
+        endElement();
+    }
+    protected void doWriteRestBindingDefinition(
+            String name,
+            RestBindingDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("enableCORS", def.getEnableCORS());
+        doWriteAttribute("type", def.getType());
+        doWriteAttribute("outType", def.getOutType());
+        doWriteAttribute("component", def.getComponent());
+        doWriteAttribute("bindingMode", def.getBindingMode());
+        doWriteAttribute("skipBindingOnErrorCode", def.getSkipBindingOnErrorCode());
+        doWriteAttribute("clientRequestValidation", def.getClientRequestValidation());
+        doWriteAttribute("produces", def.getProduces());
+        doWriteAttribute("consumes", def.getConsumes());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteRestConfigurationDefinition(
+            String name,
+            RestConfigurationDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("scheme", def.getScheme());
+        doWriteAttribute("inlineRoutes", def.getInlineRoutes());
+        doWriteAttribute("apiContextPath", def.getApiContextPath());
+        doWriteAttribute("hostNameResolver", toString(def.getHostNameResolver()));
+        doWriteAttribute("skipBindingOnErrorCode", def.getSkipBindingOnErrorCode());
+        doWriteAttribute("clientRequestValidation", def.getClientRequestValidation());
+        doWriteAttribute("producerApiDoc", def.getProducerApiDoc());
+        doWriteAttribute("host", def.getHost());
+        doWriteAttribute("producerComponent", def.getProducerComponent());
+        doWriteAttribute("enableCORS", def.getEnableCORS());
+        doWriteAttribute("useXForwardHeaders", def.getUseXForwardHeaders());
+        doWriteAttribute("apiHost", def.getApiHost());
+        doWriteAttribute("contextPath", def.getContextPath());
+        doWriteAttribute("apiContextRouteId", def.getApiContextRouteId());
+        doWriteAttribute("component", def.getComponent());
+        doWriteAttribute("bindingMode", toString(def.getBindingMode()));
+        doWriteAttribute("port", def.getPort());
+        doWriteAttribute("xmlDataFormat", def.getXmlDataFormat());
+        doWriteAttribute("apiVendorExtension", def.getApiVendorExtension());
+        doWriteAttribute("apiComponent", def.getApiComponent());
+        doWriteAttribute("jsonDataFormat", def.getJsonDataFormat());
+        doWriteList(null, "consumerProperty", def.getConsumerProperties(), this::doWriteRestPropertyDefinition);
+        doWriteList(null, "corsHeaders", def.getCorsHeaders(), this::doWriteRestPropertyDefinition);
+        doWriteList(null, "componentProperty", def.getComponentProperties(), this::doWriteRestPropertyDefinition);
+        doWriteList(null, "apiProperty", def.getApiProperties(), this::doWriteRestPropertyDefinition);
+        doWriteList(null, "endpointProperty", def.getEndpointProperties(), this::doWriteRestPropertyDefinition);
+        doWriteList(null, "dataFormatProperty", def.getDataFormatProperties(), this::doWriteRestPropertyDefinition);
+        endElement();
+    }
+    protected void doWriteRestDefinition(
+            String name,
+            RestDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("enableCORS", def.getEnableCORS());
+        doWriteAttribute("path", def.getPath());
+        doWriteAttribute("bindingMode", def.getBindingMode());
+        doWriteAttribute("apiDocs", def.getApiDocs());
+        doWriteAttribute("skipBindingOnErrorCode", def.getSkipBindingOnErrorCode());
+        doWriteAttribute("clientRequestValidation", def.getClientRequestValidation());
+        doWriteAttribute("produces", def.getProduces());
+        doWriteAttribute("disabled", def.getDisabled());
+        doWriteAttribute("tag", def.getTag());
+        doWriteAttribute("consumes", def.getConsumes());
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, "securityRequirements", def.getSecurityRequirements(), this::doWriteSecurityDefinition);
+        doWriteList(null, null, def.getVerbs(), this::doWriteVerbDefinitionRef);
+        doWriteElement("securityDefinitions", def.getSecurityDefinitions(), this::doWriteRestSecuritiesDefinition);
+        endElement();
+    }
+    protected void doWriteRestPropertyDefinition(
+            String name,
+            RestPropertyDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("value", def.getValue());
+        doWriteAttribute("key", def.getKey());
+        endElement();
+    }
+    protected void doWriteRestSecuritiesDefinition(
+            String name,
+            RestSecuritiesDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, null, def.getSecurityDefinitions(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "ApiKeyDefinition" -> doWriteApiKeyDefinition("apiKey", (ApiKeyDefinition) v);
+                case "BasicAuthDefinition" -> doWriteBasicAuthDefinition("basicAuth", (BasicAuthDefinition) v);
+                case "BearerTokenDefinition" -> doWriteBearerTokenDefinition("bearer", (BearerTokenDefinition) v);
+                case "OAuth2Definition" -> doWriteOAuth2Definition("oauth2", (OAuth2Definition) v);
+                case "OpenIdConnectDefinition" -> doWriteOpenIdConnectDefinition("openIdConnect", (OpenIdConnectDefinition) v);
+                case "MutualTLSDefinition" -> doWriteMutualTLSDefinition("mutualTLS", (MutualTLSDefinition) v);
+            }
+        });
+        endElement();
+    }
+    void doWriteRestSecurityDefinitionAttributes(
+            RestSecurityDefinition def)
+            throws IOException {
+        doWriteAttribute("description", def.getDescription());
+        doWriteAttribute("key", def.getKey());
+    }
+    protected void doWriteRestSecurityDefinition(
+            String name,
+            RestSecurityDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteRestSecurityDefinitionAttributes(def);
+        endElement();
+    }
+    protected void doWriteRestsDefinition(
+            String name,
+            RestsDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getRests(), this::doWriteRestDefinitionRef);
+        endElement();
+    }
+    protected void doWriteSecurityDefinition(
+            String name,
+            SecurityDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteAttribute("scopes", def.getScopes());
+        doWriteAttribute("key", def.getKey());
+        endElement();
+    }
+    void doWriteVerbDefinitionAttributes(VerbDefinition def) throws IOException {
+        doWriteOptionalIdentifiedDefinitionAttributes(def);
+        doWriteAttribute("enableCORS", def.getEnableCORS());
+        doWriteAttribute("deprecated", def.getDeprecated());
+        doWriteAttribute("type", def.getType());
+        doWriteAttribute("outType", def.getOutType());
+        doWriteAttribute("path", def.getPath());
+        doWriteAttribute("routeId", def.getRouteId());
+        doWriteAttribute("bindingMode", def.getBindingMode());
+        doWriteAttribute("apiDocs", def.getApiDocs());
+        doWriteAttribute("skipBindingOnErrorCode", def.getSkipBindingOnErrorCode());
+        doWriteAttribute("clientRequestValidation", def.getClientRequestValidation());
+        doWriteAttribute("produces", def.getProduces());
+        doWriteAttribute("disabled", def.getDisabled());
+        doWriteAttribute("consumes", def.getConsumes());
+    }
+    void doWriteVerbDefinitionElements(VerbDefinition def) throws IOException {
+        doWriteOptionalIdentifiedDefinitionElements(def);
+        doWriteList(null, null, def.getParams(), this::doWriteParamDefinitionRef);
+        doWriteList(null, null, def.getSecurity(), this::doWriteSecurityDefinitionRef);
+        doWriteList(null, null, def.getResponseMsgs(), this::doWriteResponseMessageDefinitionRef);
+        doWriteElement("to", def.getTo(), this::doWriteToDefinition);
+    }
+    protected void doWriteVerbDefinition(
+            String name,
+            VerbDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteVerbDefinitionAttributes(def);
+        doWriteVerbDefinitionElements(def);
+        endElement();
+    }
+    protected void doWriteCustomTransformerDefinition(
+            String name,
+            CustomTransformerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTransformerDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteAttribute("className", def.getClassName());
+        endElement();
+    }
+    protected void doWriteDataFormatTransformerDefinition(
+            String name,
+            DataFormatTransformerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTransformerDefinitionAttributes(def);
+        doWriteElement(null, def.getDataFormatType(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "ASN1DataFormat" -> doWriteASN1DataFormat("asn1", (ASN1DataFormat) def.getDataFormatType());
+                case "AvroDataFormat" -> doWriteAvroDataFormat("avro", (AvroDataFormat) def.getDataFormatType());
+                case "BarcodeDataFormat" -> doWriteBarcodeDataFormat("barcode", (BarcodeDataFormat) def.getDataFormatType());
+                case "Base64DataFormat" -> doWriteBase64DataFormat("base64", (Base64DataFormat) def.getDataFormatType());
+                case "BindyDataFormat" -> doWriteBindyDataFormat("bindy", (BindyDataFormat) def.getDataFormatType());
+                case "CBORDataFormat" -> doWriteCBORDataFormat("cbor", (CBORDataFormat) def.getDataFormatType());
+                case "CryptoDataFormat" -> doWriteCryptoDataFormat("crypto", (CryptoDataFormat) def.getDataFormatType());
+                case "CsvDataFormat" -> doWriteCsvDataFormat("csv", (CsvDataFormat) def.getDataFormatType());
+                case "CustomDataFormat" -> doWriteCustomDataFormat("custom", (CustomDataFormat) def.getDataFormatType());
+                case "FhirJsonDataFormat" -> doWriteFhirJsonDataFormat("fhirJson", (FhirJsonDataFormat) def.getDataFormatType());
+                case "FhirXmlDataFormat" -> doWriteFhirXmlDataFormat("fhirXml", (FhirXmlDataFormat) def.getDataFormatType());
+                case "FlatpackDataFormat" -> doWriteFlatpackDataFormat("flatpack", (FlatpackDataFormat) def.getDataFormatType());
+                case "GrokDataFormat" -> doWriteGrokDataFormat("grok", (GrokDataFormat) def.getDataFormatType());
+                case "GzipDeflaterDataFormat" -> doWriteGzipDeflaterDataFormat("gzipDeflater", (GzipDeflaterDataFormat) def.getDataFormatType());
+                case "HL7DataFormat" -> doWriteHL7DataFormat("hl7", (HL7DataFormat) def.getDataFormatType());
+                case "IcalDataFormat" -> doWriteIcalDataFormat("ical", (IcalDataFormat) def.getDataFormatType());
+                case "JacksonXMLDataFormat" -> doWriteJacksonXMLDataFormat("jacksonXml", (JacksonXMLDataFormat) def.getDataFormatType());
+                case "JaxbDataFormat" -> doWriteJaxbDataFormat("jaxb", (JaxbDataFormat) def.getDataFormatType());
+                case "JsonDataFormat" -> doWriteJsonDataFormat("json", (JsonDataFormat) def.getDataFormatType());
+                case "JsonApiDataFormat" -> doWriteJsonApiDataFormat("jsonApi", (JsonApiDataFormat) def.getDataFormatType());
+                case "LZFDataFormat" -> doWriteLZFDataFormat("lzf", (LZFDataFormat) def.getDataFormatType());
+                case "MimeMultipartDataFormat" -> doWriteMimeMultipartDataFormat("mimeMultipart", (MimeMultipartDataFormat) def.getDataFormatType());
+                case "ProtobufDataFormat" -> doWriteProtobufDataFormat("protobuf", (ProtobufDataFormat) def.getDataFormatType());
+                case "RssDataFormat" -> doWriteRssDataFormat("rss", (RssDataFormat) def.getDataFormatType());
+                case "SoapDataFormat" -> doWriteSoapDataFormat("soap", (SoapDataFormat) def.getDataFormatType());
+                case "SwiftMtDataFormat" -> doWriteSwiftMtDataFormat("swiftMt", (SwiftMtDataFormat) def.getDataFormatType());
+                case "SwiftMxDataFormat" -> doWriteSwiftMxDataFormat("swiftMx", (SwiftMxDataFormat) def.getDataFormatType());
+                case "SyslogDataFormat" -> doWriteSyslogDataFormat("syslog", (SyslogDataFormat) def.getDataFormatType());
+                case "TarFileDataFormat" -> doWriteTarFileDataFormat("tarFile", (TarFileDataFormat) def.getDataFormatType());
+                case "ThriftDataFormat" -> doWriteThriftDataFormat("thrift", (ThriftDataFormat) def.getDataFormatType());
+                case "TidyMarkupDataFormat" -> doWriteTidyMarkupDataFormat("tidyMarkup", (TidyMarkupDataFormat) def.getDataFormatType());
+                case "UniVocityCsvDataFormat" -> doWriteUniVocityCsvDataFormat("univocityCsv", (UniVocityCsvDataFormat) def.getDataFormatType());
+                case "UniVocityFixedDataFormat" -> doWriteUniVocityFixedDataFormat("univocityFixed", (UniVocityFixedDataFormat) def.getDataFormatType());
+                case "UniVocityTsvDataFormat" -> doWriteUniVocityTsvDataFormat("univocityTsv", (UniVocityTsvDataFormat) def.getDataFormatType());
+                case "XMLSecurityDataFormat" -> doWriteXMLSecurityDataFormat("xmlSecurity", (XMLSecurityDataFormat) def.getDataFormatType());
+                case "PGPDataFormat" -> doWritePGPDataFormat("pgp", (PGPDataFormat) def.getDataFormatType());
+                case "YAMLDataFormat" -> doWriteYAMLDataFormat("yaml", (YAMLDataFormat) def.getDataFormatType());
+                case "ZipDeflaterDataFormat" -> doWriteZipDeflaterDataFormat("zipDeflater", (ZipDeflaterDataFormat) def.getDataFormatType());
+                case "ZipFileDataFormat" -> doWriteZipFileDataFormat("zipFile", (ZipFileDataFormat) def.getDataFormatType());
+            }
+        });
+        endElement();
+    }
+    protected void doWriteEndpointTransformerDefinition(
+            String name,
+            EndpointTransformerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTransformerDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteAttribute("uri", def.getUri());
+        endElement();
+    }
+    void doWriteTransformerDefinitionAttributes(
+            TransformerDefinition def)
+            throws IOException {
+        doWriteAttribute("toType", def.getToType());
+        doWriteAttribute("fromType", def.getFromType());
+        doWriteAttribute("scheme", def.getScheme());
+    }
+    protected void doWriteTransformerDefinition(
+            String name,
+            TransformerDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteTransformerDefinitionAttributes(def);
+        endElement();
+    }
+    protected void doWriteTransformersDefinition(
+            String name,
+            TransformersDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, null, def.getTransformers(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "DataFormatTransformerDefinition" -> doWriteDataFormatTransformerDefinition("dataFormatTransformer", (DataFormatTransformerDefinition) v);
+                case "EndpointTransformerDefinition" -> doWriteEndpointTransformerDefinition("endpointTransformer", (EndpointTransformerDefinition) v);
+                case "CustomTransformerDefinition" -> doWriteCustomTransformerDefinition("customTransformer", (CustomTransformerDefinition) v);
+            }
+        });
+        endElement();
+    }
+    protected void doWriteCustomValidatorDefinition(
+            String name,
+            CustomValidatorDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteValidatorDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteAttribute("className", def.getClassName());
+        endElement();
+    }
+    protected void doWriteEndpointValidatorDefinition(
+            String name,
+            EndpointValidatorDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteValidatorDefinitionAttributes(def);
+        doWriteAttribute("ref", def.getRef());
+        doWriteAttribute("uri", def.getUri());
+        endElement();
+    }
+    protected void doWritePredicateValidatorDefinition(
+            String name,
+            PredicateValidatorDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteValidatorDefinitionAttributes(def);
+        doWriteElement(null, def.getExpression(), this::doWriteExpressionDefinitionRef);
+        endElement();
+    }
+    void doWriteValidatorDefinitionAttributes(
+            ValidatorDefinition def)
+            throws IOException {
+        doWriteAttribute("type", def.getType());
+    }
+    protected void doWriteValidatorDefinition(
+            String name,
+            ValidatorDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteValidatorDefinitionAttributes(def);
+        endElement();
+    }
+    protected void doWriteValidatorsDefinition(
+            String name,
+            ValidatorsDefinition def)
+            throws IOException {
+        startElement(name);
+        doWriteList(null, null, def.getValidators(), (n, v) -> {
+            switch (v.getClass().getSimpleName()) {
+                case "EndpointValidatorDefinition" -> doWriteEndpointValidatorDefinition("endpointValidator", (EndpointValidatorDefinition) v);
+                case "PredicateValidatorDefinition" -> doWritePredicateValidatorDefinition("predicateValidator", (PredicateValidatorDefinition) v);
+                case "CustomValidatorDefinition" -> doWriteCustomValidatorDefinition("customValidator", (CustomValidatorDefinition) v);
+            }
+        });
+        endElement();
+    }
+    void doWriteFromDefinitionRef(String n, FromDefinition v) throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "FromDefinition" -> doWriteFromDefinition("from", (FromDefinition) v);
+            }
+        }
+    }
+    void doWriteInputTypeDefinitionRef(
+            String n,
+            InputTypeDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "InputTypeDefinition" -> doWriteInputTypeDefinition("inputType", (InputTypeDefinition) v);
+            }
+        }
+    }
+    void doWriteOutputTypeDefinitionRef(
+            String n,
+            OutputTypeDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "OutputTypeDefinition" -> doWriteOutputTypeDefinition("outputType", (OutputTypeDefinition) v);
+            }
+        }
+    }
+    void doWriteProcessorDefinitionRef(
+            String n,
+            ProcessorDefinition<?> v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "AggregateDefinition" -> doWriteAggregateDefinition("aggregate", (AggregateDefinition) v);
+                case "BeanDefinition" -> doWriteBeanDefinition("bean", (BeanDefinition) v);
+                case "CatchDefinition" -> doWriteCatchDefinition("doCatch", (CatchDefinition) v);
+                case "ChoiceDefinition" -> doWriteChoiceDefinition("choice", (ChoiceDefinition) v);
+                case "CircuitBreakerDefinition" -> doWriteCircuitBreakerDefinition("circuitBreaker", (CircuitBreakerDefinition) v);
+                case "ClaimCheckDefinition" -> doWriteClaimCheckDefinition("claimCheck", (ClaimCheckDefinition) v);
+                case "ConvertBodyDefinition" -> doWriteConvertBodyDefinition("convertBodyTo", (ConvertBodyDefinition) v);
+                case "DelayDefinition" -> doWriteDelayDefinition("delay", (DelayDefinition) v);
+                case "DynamicRouterDefinition" -> doWriteDynamicRouterDefinition("dynamicRouter", (DynamicRouterDefinition) v);
+                case "EnrichDefinition" -> doWriteEnrichDefinition("enrich", (EnrichDefinition) v);
+                case "FilterDefinition" -> doWriteFilterDefinition("filter", (FilterDefinition) v);
+                case "FinallyDefinition" -> doWriteFinallyDefinition("doFinally", (FinallyDefinition) v);
+                case "IdempotentConsumerDefinition" -> doWriteIdempotentConsumerDefinition("idempotentConsumer", (IdempotentConsumerDefinition) v);
+                case "InOnlyDefinition" -> doWriteInOnlyDefinition("inOnly", (InOnlyDefinition) v);
+                case "InOutDefinition" -> doWriteInOutDefinition("inOut", (InOutDefinition) v);
+                case "InterceptDefinition" -> doWriteInterceptDefinition("intercept", (InterceptDefinition) v);
+                case "InterceptFromDefinition" -> doWriteInterceptFromDefinition("interceptFrom", (InterceptFromDefinition) v);
+                case "InterceptSendToEndpointDefinition" -> doWriteInterceptSendToEndpointDefinition("interceptSendToEndpoint", (InterceptSendToEndpointDefinition) v);
+                case "KameletDefinition" -> doWriteKameletDefinition("kamelet", (KameletDefinition) v);
+                case "LoadBalanceDefinition" -> doWriteLoadBalanceDefinition("loadBalance", (LoadBalanceDefinition) v);
+                case "LogDefinition" -> doWriteLogDefinition("log", (LogDefinition) v);
+                case "LoopDefinition" -> doWriteLoopDefinition("loop", (LoopDefinition) v);
+                case "MarshalDefinition" -> doWriteMarshalDefinition("marshal", (MarshalDefinition) v);
+                case "MulticastDefinition" -> doWriteMulticastDefinition("multicast", (MulticastDefinition) v);
+                case "OnCompletionDefinition" -> doWriteOnCompletionDefinition("onCompletion", (OnCompletionDefinition) v);
+                case "OnExceptionDefinition" -> doWriteOnExceptionDefinition("onException", (OnExceptionDefinition) v);
+                case "OnFallbackDefinition" -> doWriteOnFallbackDefinition("onFallback", (OnFallbackDefinition) v);
+                case "OtherwiseDefinition" -> doWriteOtherwiseDefinition("otherwise", (OtherwiseDefinition) v);
+                case "PausableDefinition" -> doWritePausableDefinition("pausable", (PausableDefinition) v);
+                case "PipelineDefinition" -> doWritePipelineDefinition("pipeline", (PipelineDefinition) v);
+                case "PolicyDefinition" -> doWritePolicyDefinition("policy", (PolicyDefinition) v);
+                case "PollEnrichDefinition" -> doWritePollEnrichDefinition("pollEnrich", (PollEnrichDefinition) v);
+                case "ProcessDefinition" -> doWriteProcessDefinition("process", (ProcessDefinition) v);
+                case "RecipientListDefinition" -> doWriteRecipientListDefinition("recipientList", (RecipientListDefinition) v);
+                case "RemoveHeaderDefinition" -> doWriteRemoveHeaderDefinition("removeHeader", (RemoveHeaderDefinition) v);
+                case "RemoveHeadersDefinition" -> doWriteRemoveHeadersDefinition("removeHeaders", (RemoveHeadersDefinition) v);
+                case "RemovePropertiesDefinition" -> doWriteRemovePropertiesDefinition("removeProperties", (RemovePropertiesDefinition) v);
+                case "RemovePropertyDefinition" -> doWriteRemovePropertyDefinition("removeProperty", (RemovePropertyDefinition) v);
+                case "ResequenceDefinition" -> doWriteResequenceDefinition("resequence", (ResequenceDefinition) v);
+                case "ResumableDefinition" -> doWriteResumableDefinition("resumable", (ResumableDefinition) v);
+                case "RollbackDefinition" -> doWriteRollbackDefinition("rollback", (RollbackDefinition) v);
+                case "RouteDefinition" -> doWriteRouteDefinition("route", (RouteDefinition) v);
+                case "RoutingSlipDefinition" -> doWriteRoutingSlipDefinition("routingSlip", (RoutingSlipDefinition) v);
+                case "SagaDefinition" -> doWriteSagaDefinition("saga", (SagaDefinition) v);
+                case "SamplingDefinition" -> doWriteSamplingDefinition("sample", (SamplingDefinition) v);
+                case "ScriptDefinition" -> doWriteScriptDefinition("script", (ScriptDefinition) v);
+                case "SetBodyDefinition" -> doWriteSetBodyDefinition("setBody", (SetBodyDefinition) v);
+                case "SetExchangePatternDefinition" -> doWriteSetExchangePatternDefinition("setExchangePattern", (SetExchangePatternDefinition) v);
+                case "SetHeaderDefinition" -> doWriteSetHeaderDefinition("setHeader", (SetHeaderDefinition) v);
+                case "SetPropertyDefinition" -> doWriteSetPropertyDefinition("setProperty", (SetPropertyDefinition) v);
+                case "SortDefinition" -> doWriteSortDefinition("sort", (SortDefinition) v);
+                case "SplitDefinition" -> doWriteSplitDefinition("split", (SplitDefinition) v);
+                case "StepDefinition" -> doWriteStepDefinition("step", (StepDefinition) v);
+                case "StopDefinition" -> doWriteStopDefinition("stop", (StopDefinition) v);
+                case "ThreadsDefinition" -> doWriteThreadsDefinition("threads", (ThreadsDefinition) v);
+                case "ThrottleDefinition" -> doWriteThrottleDefinition("throttle", (ThrottleDefinition) v);
+                case "ThrowExceptionDefinition" -> doWriteThrowExceptionDefinition("throwException", (ThrowExceptionDefinition) v);
+                case "ToDefinition" -> doWriteToDefinition("to", (ToDefinition) v);
+                case "ToDynamicDefinition" -> doWriteToDynamicDefinition("toD", (ToDynamicDefinition) v);
+                case "TransactedDefinition" -> doWriteTransactedDefinition("transacted", (TransactedDefinition) v);
+                case "TransformDefinition" -> doWriteTransformDefinition("transform", (TransformDefinition) v);
+                case "TryDefinition" -> doWriteTryDefinition("doTry", (TryDefinition) v);
+                case "UnmarshalDefinition" -> doWriteUnmarshalDefinition("unmarshal", (UnmarshalDefinition) v);
+                case "ValidateDefinition" -> doWriteValidateDefinition("validate", (ValidateDefinition) v);
+                case "WhenDefinition" -> doWriteWhenDefinition("when", (WhenDefinition) v);
+                case "WireTapDefinition" -> doWriteWireTapDefinition("wireTap", (WireTapDefinition) v);
+                case "ServiceCallDefinition" -> doWriteServiceCallDefinition("serviceCall", (ServiceCallDefinition) v);
+            }
+        }
+    }
+    void doWriteRouteConfigurationDefinitionRef(
+            String n,
+            RouteConfigurationDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "RouteConfigurationDefinition" -> doWriteRouteConfigurationDefinition("routeConfiguration", (RouteConfigurationDefinition) v);
+            }
+        }
+    }
+    void doWriteRouteDefinitionRef(
+            String n,
+            RouteDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "RouteDefinition" -> doWriteRouteDefinition("route", (RouteDefinition) v);
+            }
+        }
+    }
+    void doWriteRouteTemplateDefinitionRef(
+            String n,
+            RouteTemplateDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "RouteTemplateDefinition" -> doWriteRouteTemplateDefinition("routeTemplate", (RouteTemplateDefinition) v);
+            }
+        }
+    }
+    void doWriteTemplatedRouteDefinitionRef(
+            String n,
+            TemplatedRouteDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "TemplatedRouteDefinition" -> doWriteTemplatedRouteDefinition("templatedRoute", (TemplatedRouteDefinition) v);
+            }
+        }
+    }
+    void doWriteWhenDefinitionRef(String n, WhenDefinition v) throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "WhenDefinition" -> doWriteWhenDefinition("when", (WhenDefinition) v);
+            }
+        }
+    }
+    void doWriteUniVocityHeaderRef(
+            String n,
+            UniVocityHeader v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "UniVocityHeader" -> doWriteUniVocityHeader("univocityHeader", (UniVocityHeader) v);
+            }
+        }
+    }
+    void doWriteExpressionDefinitionRef(
+            String n,
+            ExpressionDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "CSimpleExpression" -> doWriteCSimpleExpression("csimple", (CSimpleExpression) v);
+                case "ConstantExpression" -> doWriteConstantExpression("constant", (ConstantExpression) v);
+                case "DatasonnetExpression" -> doWriteDatasonnetExpression("datasonnet", (DatasonnetExpression) v);
+                case "ExchangePropertyExpression" -> doWriteExchangePropertyExpression("exchangeProperty", (ExchangePropertyExpression) v);
+                case "ExpressionDefinition" -> doWriteExpressionDefinition("##default", (ExpressionDefinition) v);
+                case "GroovyExpression" -> doWriteGroovyExpression("groovy", (GroovyExpression) v);
+                case "HeaderExpression" -> doWriteHeaderExpression("header", (HeaderExpression) v);
+                case "Hl7TerserExpression" -> doWriteHl7TerserExpression("hl7terser", (Hl7TerserExpression) v);
+                case "JavaScriptExpression" -> doWriteJavaScriptExpression("js", (JavaScriptExpression) v);
+                case "JoorExpression" -> doWriteJoorExpression("joor", (JoorExpression) v);
+                case "JqExpression" -> doWriteJqExpression("jq", (JqExpression) v);
+                case "JsonPathExpression" -> doWriteJsonPathExpression("jsonpath", (JsonPathExpression) v);
+                case "LanguageExpression" -> doWriteLanguageExpression("language", (LanguageExpression) v);
+                case "MethodCallExpression" -> doWriteMethodCallExpression("method", (MethodCallExpression) v);
+                case "MvelExpression" -> doWriteMvelExpression("mvel", (MvelExpression) v);
+                case "OgnlExpression" -> doWriteOgnlExpression("ognl", (OgnlExpression) v);
+                case "PythonExpression" -> doWritePythonExpression("python", (PythonExpression) v);
+                case "RefExpression" -> doWriteRefExpression("ref", (RefExpression) v);
+                case "SimpleExpression" -> doWriteSimpleExpression("simple", (SimpleExpression) v);
+                case "SpELExpression" -> doWriteSpELExpression("spel", (SpELExpression) v);
+                case "TokenizerExpression" -> doWriteTokenizerExpression("tokenize", (TokenizerExpression) v);
+                case "XMLTokenizerExpression" -> doWriteXMLTokenizerExpression("xtokenize", (XMLTokenizerExpression) v);
+                case "XPathExpression" -> doWriteXPathExpression("xpath", (XPathExpression) v);
+                case "XQueryExpression" -> doWriteXQueryExpression("xquery", (XQueryExpression) v);
+            }
+        }
+    }
+    void doWriteParamDefinitionRef(
+            String n,
+            ParamDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "ParamDefinition" -> doWriteParamDefinition("param", (ParamDefinition) v);
+            }
+        }
+    }
+    void doWriteResponseMessageDefinitionRef(
+            String n,
+            ResponseMessageDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "ResponseMessageDefinition" -> doWriteResponseMessageDefinition("responseMessage", (ResponseMessageDefinition) v);
+            }
+        }
+    }
+    void doWriteRestDefinitionRef(String n, RestDefinition v) throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "RestDefinition" -> doWriteRestDefinition("rest", (RestDefinition) v);
+            }
+        }
+    }
+    void doWriteSecurityDefinitionRef(
+            String n,
+            SecurityDefinition v)
+            throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "SecurityDefinition" -> doWriteSecurityDefinition("security", (SecurityDefinition) v);
+            }
+        }
+    }
+    void doWriteVerbDefinitionRef(String n, VerbDefinition v) throws IOException {
+        if (v != null) {
+            switch (v.getClass().getSimpleName()) {
+                case "DeleteDefinition" -> doWriteDeleteDefinition("delete", (DeleteDefinition) v);
+                case "GetDefinition" -> doWriteGetDefinition("get", (GetDefinition) v);
+                case "HeadDefinition" -> doWriteHeadDefinition("head", (HeadDefinition) v);
+                case "PatchDefinition" -> doWritePatchDefinition("patch", (PatchDefinition) v);
+                case "PostDefinition" -> doWritePostDefinition("post", (PostDefinition) v);
+                case "PutDefinition" -> doWritePutDefinition("put", (PutDefinition) v);
+            }
+        }
+    }
+    void doWriteAttribute(String attribute, String value) throws IOException {
+        if (value != null) {
+            attribute(attribute, value);
+        }
+    }
+    void doWriteValue(String value) throws IOException {
+        if (value != null) {
+            text(value);
+        }
+    }
+    private <T> void doWriteList(String wrapperName, String name, List<T> list, ElementSerializer<T> elementSerializer) throws IOException {
+        if (list != null) {
+            if (wrapperName != null) {
+                startElement(wrapperName);
+            }
+            for (T v : list) {
+                elementSerializer.doWriteElement(name, v);
+            }
+            if (wrapperName != null) {
+                endElement();
+            }
+        }
+    }
+    private <T> void doWriteElement(String name, T v, ElementSerializer<T> elementSerializer) throws IOException {
+        if (v != null) {
+            elementSerializer.doWriteElement(name, v);
+        }
+    }
+    String toString(Boolean b) {
+        return b != null ? b.toString() : null;
+    }
+    String toString(Enum<?> e) {
+        return e != null ? e.name() : null;
+    }
+    String toString(Number n) {
+        return n != null ? n.toString() : null;
+    }
+    String toString(byte[] b) {
+        return b != null ? Base64.getEncoder().encodeToString(b) : null;
+    }
+    void doWriteString(String name, String value) throws IOException {
+        if (value != null) {
+            startElement(name);
+            text(value);
+            endElement();
+        }
+    }
+
+    public interface ElementSerializer<T> {
+        void doWriteElement(String name, T value) throws IOException;
+    }
+}
+//CHECKSTYLE:ON
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java
new file mode 100644
index 00000000000..bdce1b84984
--- /dev/null
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java
@@ -0,0 +1,353 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.xml.io;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * XML writer which emits nicely formatted documents.
+ */
+public class XMLWriter {
+
+    private static final Pattern AMP = Pattern.compile("&");
+    private static final Pattern LT = Pattern.compile("<");
+    private static final Pattern GT = Pattern.compile(">");
+    private static final Pattern DQUOTE = Pattern.compile("\"");
+    private static final Pattern SQUOTE = Pattern.compile("\'");
+    private static final Pattern CRLF = Pattern.compile("\r\n");
+    private static final Pattern LOWERS = Pattern.compile("([\000-\037])");
+
+    private final Writer writer;
+    private final String lineIndenter;
+    private final String lineSeparator;
+    private final String encoding;
+    private final String docType;
+    private final Deque<String> elements = new ArrayDeque<>();
+    private boolean tagInProgress;
+    private int depth;
+    private boolean readyForNewLine;
+    private boolean tagIsEmpty;
+
+    /**
+     * @param writer not null
+     */
+    public XMLWriter(Writer writer) throws IOException {
+        this(writer, null, null);
+    }
+
+    /**
+     * @param writer       not null
+     * @param lineIndenter could be null, but the normal way is some spaces.
+     */
+    public XMLWriter(Writer writer, String lineIndenter) throws IOException {
+        this(writer, lineIndenter, null, null);
+    }
+
+    /**
+     * @param writer   not null
+     * @param encoding could be null or invalid.
+     * @param doctype  could be null.
+     */
+    public XMLWriter(Writer writer, String encoding, String doctype) throws IOException {
+        this(writer, null, encoding, doctype);
+    }
+
+    /**
+     * @param writer       not null
+     * @param lineIndenter could be null, but the normal way is some spaces.
+     * @param encoding     could be null or invalid.
+     * @param doctype      could be null.
+     */
+    public XMLWriter(Writer writer, String lineIndenter, String encoding, String doctype) throws IOException {
+        this(writer, lineIndenter, null, encoding, doctype);
+    }
+
+    /**
+     * @param writer        not null
+     * @param lineIndenter  could be null, but the normal way is some spaces.
+     * @param lineSeparator could be null, but the normal way is valid line separator ("\n" on UNIX).
+     * @param encoding      could be null or invalid.
+     * @param doctype       could be null.
+     */
+    public XMLWriter(Writer writer, String lineIndenter, String lineSeparator,
+                     String encoding, String doctype) throws IOException {
+        this.writer = writer;
+        this.lineIndenter = lineIndenter != null ? lineIndenter : "  ";
+        this.lineSeparator = validateLineSeparator(lineSeparator);
+        this.encoding = encoding;
+        this.docType = doctype;
+        if (doctype != null || encoding != null) {
+            writeDocumentHeaders();
+        }
+    }
+
+    private static String validateLineSeparator(String lineSeparator) {
+        String ls = lineSeparator != null ? lineSeparator : System.lineSeparator();
+        if (!(ls.equals("\n") || ls.equals("\r") || ls.equals("\r\n"))) {
+            throw new IllegalArgumentException("Requested line separator is invalid.");
+        }
+        return ls;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void startElement(String name) throws IOException {
+        tagIsEmpty = false;
+        finishTag();
+        write("<");
+        write(name);
+        elements.addLast(name);
+        tagInProgress = true;
+        depth++;
+        readyForNewLine = true;
+        tagIsEmpty = true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void writeText(String text) throws IOException {
+        writeText(text, true);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void writeMarkup(String text) throws IOException {
+        writeText(text, false);
+    }
+
+    private void writeText(String text, boolean escapeXml) throws IOException {
+        readyForNewLine = false;
+        tagIsEmpty = false;
+        finishTag();
+        if (escapeXml) {
+            text = escapeXml(text);
+        }
+        write(unifyLineSeparators(text));
+    }
+
+    /**
+     * Parses the given String and replaces all occurrences of '\n', '\r' and '\r\n' with the system line separator.
+     *
+     * @param  s                        a not null String
+     * @return                          a String that contains only System line separators.
+     * @throws IllegalArgumentException if ls is not '\n', '\r' and '\r\n' characters.
+     * @since                           1.5.7
+     */
+    private String unifyLineSeparators(String s) {
+        if (s == null) {
+            return null;
+        }
+        int length = s.length();
+        StringBuilder buffer = new StringBuilder(length);
+        for (int i = 0; i < length; i++) {
+            if (s.charAt(i) == '\r') {
+                if ((i + 1) < length && s.charAt(i + 1) == '\n') {
+                    i++;
+                }
+                buffer.append(lineSeparator);
+            } else if (s.charAt(i) == '\n') {
+                buffer.append(lineSeparator);
+            } else {
+                buffer.append(s.charAt(i));
+            }
+        }
+        return buffer.toString();
+    }
+
+    private static String escapeXml(String text) {
+        if (text.indexOf('&') >= 0) {
+            text = AMP.matcher(text).replaceAll("&amp;");
+        }
+        if (text.indexOf('<') >= 0) {
+            text = LT.matcher(text).replaceAll("&lt;");
+        }
+        if (text.indexOf('>') >= 0) {
+            text = GT.matcher(text).replaceAll("&gt;");
+        }
+        if (text.indexOf('"') >= 0) {
+            text = DQUOTE.matcher(text).replaceAll("&quot;");
+        }
+        if (text.indexOf('\'') >= 0) {
+            text = SQUOTE.matcher(text).replaceAll("&apos;");
+        }
+
+        return text;
+    }
+
+    private static String escapeXmlAttribute(String text) {
+        text = escapeXml(text);
+
+        // Windows
+        text = CRLF.matcher(text).replaceAll("&#10;");
+
+        StringBuilder b = new StringBuilder();
+        Matcher m = LOWERS.matcher(text);
+        while (m.find()) {
+            m.appendReplacement(b, "&#" + Integer.toString(m.group(1).charAt(0)) + ";");
+        }
+        m.appendTail(b);
+
+        return b.toString();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addAttribute(String key, String value) throws IOException {
+        write(" ");
+        write(key);
+        write("=\"");
+        write(escapeXmlAttribute(value));
+        write("\"");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void endElement() throws IOException {
+        depth--;
+
+        if (tagIsEmpty) {
+            write("/");
+            readyForNewLine = false;
+            finishTag();
+            elements.removeLast();
+        } else {
+            finishTag();
+            write("</" + elements.removeLast() + ">");
+        }
+
+        readyForNewLine = true;
+    }
+
+    /**
+     * Write a string to the underlying writer
+     */
+    private void write(String str) throws IOException {
+        getWriter().write(str);
+    }
+
+    private void finishTag() throws IOException {
+        if (tagInProgress) {
+            write(">");
+        }
+        tagInProgress = false;
+        if (readyForNewLine) {
+            endOfLine();
+        }
+        readyForNewLine = false;
+        tagIsEmpty = false;
+    }
+
+    /**
+     * Get the string used as line indenter
+     *
+     * @return the line indenter
+     */
+    protected String getLineIndenter() {
+        return lineIndenter;
+    }
+
+    /**
+     * Get the string used as line separator or LS if not set.
+     *
+     * @return the line separator
+     * @see    System#lineSeparator()
+     */
+    protected String getLineSeparator() {
+        return lineSeparator;
+    }
+
+    /**
+     * Write the end of line character (using specified line separator) and start new line with indentation
+     *
+     * @see #getLineIndenter()
+     * @see #getLineSeparator()
+     */
+    protected void endOfLine() throws IOException {
+        write(getLineSeparator());
+        for (int i = 0; i < getDepth(); i++) {
+            write(getLineIndenter());
+        }
+    }
+
+    private void writeDocumentHeaders() throws IOException {
+        write("<?xml version=\"1.0\"");
+        if (getEncoding() != null) {
+            write(" encoding=\"" + getEncoding() + "\"");
+        }
+        write("?>");
+        endOfLine();
+        if (getDocType() != null) {
+            write("<!DOCTYPE ");
+            write(getDocType());
+            write(">");
+            endOfLine();
+        }
+    }
+
+    /**
+     * Get the underlying writer
+     *
+     * @return the underlying writer
+     */
+    protected Writer getWriter() {
+        return writer;
+    }
+
+    /**
+     * Get the current depth in the xml indentation
+     *
+     * @return the current depth
+     */
+    protected int getDepth() {
+        return depth;
+    }
+
+    /**
+     * Get the current encoding in the xml
+     *
+     * @return the current encoding
+     */
+    protected String getEncoding() {
+        return encoding;
+    }
+
+    /**
+     * Get the docType in the xml
+     *
+     * @return the current docType
+     */
+    public String getDocType() {
+        return docType;
+    }
+
+    /**
+     * @return the current elementStack;
+     */
+    public Deque<String> getElements() {
+        return elements;
+    }
+}
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java
new file mode 100644
index 00000000000..ba4cf52a033
--- /dev/null
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.xml.out;
+
+import java.io.IOException;
+import java.io.Writer;
+
+import org.apache.camel.xml.io.XMLWriter;
+
+public class BaseWriter {
+
+    private final XMLWriter writer;
+    private final String namespace;
+    private boolean namespaceWritten;
+
+    public BaseWriter(Writer writer, String namespace) throws IOException {
+        this.writer = new XMLWriter(writer);
+        this.namespace = namespace;
+    }
+
+    protected void startElement(String name) throws IOException {
+        writer.startElement(name);
+        if (!namespaceWritten && namespace != null) {
+            writer.addAttribute("xmlns", namespace);
+            namespaceWritten = true;
+        }
+    }
+
+    protected void endElement() throws IOException {
+        writer.endElement();
+    }
+
+    protected void text(String text) throws IOException {
+        writer.writeText(text);
+    }
+
+    protected void attribute(String name, String value) throws IOException {
+        writer.addAttribute(name, value);
+    }
+}
diff --git a/core/camel-xml-io/src/test/java/org/apache/camel/xml/out/ModelWriterTest.java b/core/camel-xml-io/src/test/java/org/apache/camel/xml/out/ModelWriterTest.java
new file mode 100644
index 00000000000..9932a5b375b
--- /dev/null
+++ b/core/camel-xml-io/src/test/java/org/apache/camel/xml/out/ModelWriterTest.java
@@ -0,0 +1,224 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.xml.out;
+
+import java.io.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Stream;
+
+import jakarta.xml.bind.annotation.XmlTransient;
+
+import org.apache.camel.model.RouteTemplatesDefinition;
+import org.apache.camel.model.RoutesDefinition;
+import org.apache.camel.model.TemplatedRoutesDefinition;
+import org.apache.camel.model.rest.RestsDefinition;
+import org.apache.camel.xml.in.ModelParser;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.AssertionFailureBuilder.assertionFailure;
+import static org.junit.jupiter.api.Assertions.*;
+
+public class ModelWriterTest {
+
+    public static final String NAMESPACE = "http://camel.apache.org/schema/spring";
+
+    private static final Map<Field, Boolean> TRANSIENT = new ConcurrentHashMap<>();
+
+    @ParameterizedTest
+    @MethodSource("routes")
+    @DisplayName("Test xml roundtrip for <routes>")
+    void testRoutes(String xml, String ns) throws Exception {
+        try (InputStream is = getClass().getClassLoader().getResourceAsStream(xml)) {
+            RoutesDefinition expected = new ModelParser(is, NAMESPACE).parseRoutesDefinition().get();
+            StringWriter sw = new StringWriter();
+            new ModelWriter(sw, ns).writeRoutesDefinition(expected);
+            RoutesDefinition actual = new ModelParser(new StringReader(sw.toString()), ns).parseRoutesDefinition().get();
+            assertDeepEquals(expected, actual, sw.toString());
+        }
+    }
+
+    @ParameterizedTest
+    @MethodSource("rests")
+    @DisplayName("Test xml roundtrip for <rests>")
+    void testRests(String xml, String ns) throws Exception {
+        try (InputStream is = getClass().getClassLoader().getResourceAsStream(xml)) {
+            RestsDefinition expected = new ModelParser(is, NAMESPACE).parseRestsDefinition().get();
+            StringWriter sw = new StringWriter();
+            new ModelWriter(sw, ns).writeRestsDefinition(expected);
+            RestsDefinition actual = new ModelParser(new StringReader(sw.toString()), ns).parseRestsDefinition().get();
+            assertDeepEquals(expected, actual, sw.toString());
+        }
+    }
+
+    @ParameterizedTest
+    @MethodSource("routeTemplates")
+    @DisplayName("Test xml roundtrip for <routeTemplates>")
+    void testRouteTemplates(String xml, String ns) throws Exception {
+        try (InputStream is = getClass().getClassLoader().getResourceAsStream(xml)) {
+            RouteTemplatesDefinition expected = new ModelParser(is, NAMESPACE).parseRouteTemplatesDefinition().get();
+            StringWriter sw = new StringWriter();
+            new ModelWriter(sw, ns).writeRouteTemplatesDefinition(expected);
+            RouteTemplatesDefinition actual
+                    = new ModelParser(new StringReader(sw.toString()), ns).parseRouteTemplatesDefinition().get();
+            assertDeepEquals(expected, actual, sw.toString());
+        }
+    }
+
+    @ParameterizedTest
+    @MethodSource("templatedRoutes")
+    @DisplayName("Test xml roundtrip for <templatedRoutes>")
+    void testTemplatedRoutes(String xml, String ns) throws Exception {
+        try (InputStream is = getClass().getClassLoader().getResourceAsStream(xml)) {
+            TemplatedRoutesDefinition expected = new ModelParser(is, NAMESPACE).parseTemplatedRoutesDefinition().get();
+            StringWriter sw = new StringWriter();
+            new ModelWriter(sw, ns).writeTemplatedRoutesDefinition(expected);
+            TemplatedRoutesDefinition actual
+                    = new ModelParser(new StringReader(sw.toString()), ns).parseTemplatedRoutesDefinition().get();
+            assertDeepEquals(expected, actual, sw.toString());
+        }
+    }
+
+    private static Stream<Arguments> routes() {
+        return definitions("routes");
+    }
+
+    private static Stream<Arguments> rests() {
+        return definitions("rests");
+    }
+
+    private static Stream<Arguments> routeTemplates() {
+        return definitions("routeTemplates");
+    }
+
+    private static Stream<Arguments> templatedRoutes() {
+        return definitions("templatedRoutes");
+    }
+
+    private static Stream<Arguments> definitions(String xml) {
+        try {
+            return Files.list(Paths.get("src/test/resources"))
+                    .filter(p -> {
+                        try {
+                            return Files.isRegularFile(p)
+                                    && p.getFileName().toString().endsWith(".xml")
+                                    && Files.readString(p).contains("<" + xml);
+                        } catch (IOException e) {
+                            throw new IOError(e);
+                        }
+                    })
+                    .map(p -> p.getFileName().toString())
+                    .flatMap(p -> Stream.of(Arguments.of(p, ""), Arguments.of(p, NAMESPACE)));
+        } catch (IOException e) {
+            throw new IOError(e);
+        }
+    }
+
+    private static void assertDeepEquals(Object expected, Object actual, String message) {
+        try {
+            try {
+                deepEquals(expected, actual, "");
+            } catch (AssertionError e) {
+                assertionFailure() //
+                        .cause(e)
+                        .message(message) //
+                        .expected(expected) //
+                        .actual(actual) //
+                        .buildAndThrow();
+            }
+        } catch (IllegalAccessException e) {
+            assertionFailure().cause(e).buildAndThrow();
+        }
+    }
+
+    private static void deepEquals(Object expected, Object actual, String path) throws IllegalAccessException {
+        if (expected == null || actual == null) {
+            assertSame(expected, actual, path);
+        } else if (expected.getClass() != actual.getClass()) {
+            fail("Not equals at " + path);
+        } else if (expected instanceof Collection) {
+            Iterator<?> ie = ((Collection) expected).iterator();
+            Iterator<?> ia = ((Collection) actual).iterator();
+            int i = 0;
+            while (ie.hasNext() && ia.hasNext()) {
+                deepEquals(ie.next(), ia.next(), path + "[" + (i++) + "]");
+            }
+            assertEquals(ie.hasNext(), ia.hasNext(), path);
+        } else if (expected.getClass() == AtomicBoolean.class) {
+            assertEquals(((AtomicBoolean) expected).get(), ((AtomicBoolean) actual).get(), path);
+        } else if (expected.getClass().isEnum()) {
+            assertEquals(((Enum) expected).name(), ((Enum) actual).name(), path);
+        } else if (expected.getClass().getName().startsWith("java.")) {
+            assertEquals(expected, actual, path);
+        } else {
+            for (Class<?> clazz = expected.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) {
+                for (Field field : clazz.getDeclaredFields()) {
+                    if (isTransient(field)) {
+                        continue;
+                    }
+                    field.setAccessible(true);
+                    Object fe = field.get(expected);
+                    Object fa = field.get(actual);
+                    deepEquals(fe, fa, (path.length() > 0 ? path + "." : path) + field.getName());
+                }
+            }
+        }
+    }
+
+    private static boolean isTransient(Field field) {
+        return TRANSIENT.computeIfAbsent(field, ModelWriterTest::checkIsTransient);
+    }
+
+    private static boolean checkIsTransient(Field field) {
+        if (Modifier.isStatic(field.getModifiers())) {
+            return true;
+        }
+        if (field.getAnnotation(XmlTransient.class) != null) {
+            return true;
+        }
+        String name = field.getName();
+        try {
+            Method method = field.getDeclaringClass().getDeclaredMethod(
+                    "get" + name.substring(0, 1).toUpperCase() + name.substring(1));
+            if (method.getAnnotation(XmlTransient.class) != null) {
+                return true;
+            }
+        } catch (Exception t) {
+            // ignore
+        }
+        try {
+            Method method = field.getDeclaringClass().getDeclaredMethod(
+                    "set" + name.substring(0, 1).toUpperCase() + name.substring(1),
+                    field.getType());
+            if (method.getAnnotation(XmlTransient.class) != null) {
+                return true;
+            }
+        } catch (Exception t) {
+            // ignore
+        }
+        return false;
+    }
+}
diff --git a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
index 691fb78c799..6b2c544940b 100644
--- a/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
+++ b/dsl/camel-yaml-dsl/camel-yaml-dsl-deserializers/src/generated/java/org/apache/camel/dsl/yaml/deserializers/ModelDeserializers.java
@@ -1126,7 +1126,7 @@ public final class ModelDeserializers extends YamlDeserializerSupport {
                 }
                 case "class-type": {
                     String val = asText(node);
-                    target.setClassType(val);
+                    target.setClassTypeAsString(val);
                     break;
                 }
                 case "id": {
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java
new file mode 100644
index 00000000000..a833b9baebc
--- /dev/null
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java
@@ -0,0 +1,834 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.maven.packaging;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Writer;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import jakarta.xml.bind.annotation.XmlAccessType;
+import jakarta.xml.bind.annotation.XmlAccessorType;
+import jakarta.xml.bind.annotation.XmlAnyAttribute;
+import jakarta.xml.bind.annotation.XmlAttribute;
+import jakarta.xml.bind.annotation.XmlElement;
+import jakarta.xml.bind.annotation.XmlElementRef;
+import jakarta.xml.bind.annotation.XmlElementRefs;
+import jakarta.xml.bind.annotation.XmlElementWrapper;
+import jakarta.xml.bind.annotation.XmlElements;
+import jakarta.xml.bind.annotation.XmlEnum;
+import jakarta.xml.bind.annotation.XmlRootElement;
+import jakarta.xml.bind.annotation.XmlTransient;
+import jakarta.xml.bind.annotation.XmlType;
+import jakarta.xml.bind.annotation.XmlValue;
+import jakarta.xml.bind.annotation.adapters.XmlAdapter;
+import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+
+import org.apache.camel.maven.packaging.generics.JandexStore;
+import org.apache.camel.tooling.util.srcgen.GenericType;
+import org.apache.camel.tooling.util.srcgen.JavaClass;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.Index;
+import org.jboss.jandex.IndexReader;
+import org.sonatype.plexus.build.incremental.BuildContext;
+
+/**
+ * Generate Model lightweight XML Writer source code.
+ */
+@Mojo(name = "generate-xml-writer", threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME,
+      defaultPhase = LifecyclePhase.PROCESS_CLASSES)
+public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
+
+    public static final String XML_SERIALIZER_PACKAGE = "org.apache.camel.xml.io";
+    public static final String WRITER_PACKAGE = "org.apache.camel.xml.out";
+    public static final String MODEL_PACKAGE = "org.apache.camel.model";
+
+    @Parameter(defaultValue = "${project.basedir}/src/generated/java")
+    protected File sourcesOutputDir;
+
+    @Parameter(defaultValue = "${camel-generate-xml-writer}")
+    protected boolean generateXmlWriter;
+
+    @Override
+    public void execute(MavenProject project, MavenProjectHelper projectHelper, BuildContext buildContext)
+            throws MojoFailureException, MojoExecutionException {
+        sourcesOutputDir = new File(project.getBasedir(), "src/generated/java");
+        generateXmlWriter = Boolean.parseBoolean(project.getProperties().getProperty("camel-generate-xml-writer", "false"));
+        super.execute(project, projectHelper, buildContext);
+    }
+
+    @Override
+    public void execute() throws MojoExecutionException {
+        if (!generateXmlWriter) {
+            return;
+        }
+        Path javaDir = sourcesOutputDir.toPath();
+        String parser = generateWriter();
+        updateResource(javaDir, (WRITER_PACKAGE + ".ModelWriter").replace('.', '/') + ".java", parser);
+    }
+
+    public String generateWriter() throws MojoExecutionException {
+        ClassLoader classLoader;
+        try {
+            classLoader = DynamicClassLoader.createDynamicClassLoader(project.getCompileClasspathElements());
+        } catch (DependencyResolutionRequiredException e) {
+            throw new MojoExecutionException("DependencyResolutionRequiredException: " + e.getMessage(), e);
+        }
+
+        Class<?> routesDefinitionClass = loadClass(classLoader, MODEL_PACKAGE + ".RoutesDefinition");
+        String resName = routesDefinitionClass.getName().replace('.', '/') + ".class";
+        String url = classLoader.getResource(resName).toExternalForm().replace(resName, JandexStore.DEFAULT_NAME);
+        Index index;
+        try (InputStream is = new URL(url).openStream()) {
+            index = new IndexReader(is).read();
+        } catch (IOException e) {
+            throw new MojoExecutionException("IOException: " + e.getMessage(), e);
+        }
+        List<String> names = Stream.of(XmlRootElement.class, XmlEnum.class, XmlType.class)
+                .map(c -> index.getAnnotations(DotName.createSimple(c.getName())))
+                .flatMap(Collection::stream)
+                .map(ai -> ai.target().asClass().name().toString())
+                .sorted().distinct()
+                .toList();
+        List<Class<?>> model = names
+                .stream()
+                // we should skip this model as we do not want this in the JAXB model
+                .filter(n -> !n.equals("org.apache.camel.model.WhenSkipSendToEndpointDefinition"))
+                .map(name -> loadClass(classLoader, name))
+                .flatMap(this::references).flatMap(this::fieldReferences).distinct()
+                .sorted(Comparator.comparing(Class::getName))
+                .toList();
+
+        JavaClass writer = generateWriter(model, classLoader);
+        return "/*\n" + " * Licensed to the Apache Software Foundation (ASF) under one or more\n"
+               + " * contributor license agreements.  See the NOTICE file distributed with\n"
+               + " * this work for additional information regarding copyright ownership.\n"
+               + " * The ASF licenses this file to You under the Apache License, Version 2.0\n"
+               + " * (the \"License\"); you may not use this file except in compliance with\n"
+               + " * the License.  You may obtain a copy of the License at\n" + " *\n"
+               + " *      http://www.apache.org/licenses/LICENSE-2.0\n" + " *\n"
+               + " * Unless required by applicable law or agreed to in writing, software\n"
+               + " * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
+               + " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
+               + " * See the License for the specific language governing permissions and\n"
+               + " * limitations under the License.\n" + " */\n" + "\n" + "//CHECKSTYLE:OFF\n" + "\n"
+               + "\n/**\n * Generated by Camel build tools - do NOT edit this file!\n */\n"
+               + writer.printClass() + "\n" + "//CHECKSTYLE:ON\n";
+    }
+
+    protected Class<?> loadClass(ClassLoader loader, String name) {
+        try {
+            return loader.loadClass(name);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException("Unable to load class " + name, e);
+        }
+    }
+
+    private Stream<Class<?>> references(Class<?> clazz) {
+        List<Class<?>> allClasses = new ArrayList<>();
+        for (Class<?> cl = clazz; cl != Object.class; cl = cl.getSuperclass()) {
+            allClasses.add(cl);
+        }
+        return allClasses.stream();
+    }
+
+    private Stream<Class<?>> fieldReferences(Class<?> clazz) {
+        return Stream.concat(Stream.of(clazz),
+                getProperties(clazz).map(f -> {
+                    if (f.getAnnotation(XmlJavaTypeAdapter.class) != null) {
+                        Class<?> cl = f.getAnnotation(XmlJavaTypeAdapter.class).value();
+                        while (cl.getSuperclass() != XmlAdapter.class) {
+                            cl = cl.getSuperclass();
+                        }
+                        return ((ParameterizedType) cl.getGenericSuperclass()).getActualTypeArguments()[0];
+                    } else {
+                        return f.getType();
+                    }
+                })
+                        .map(t -> {
+                            GenericType gt = new GenericType(t);
+                            GenericType ac = gt.getRawClass() == List.class ? gt.getActualTypeArgument(0) : gt;
+                            return ac.getRawClass();
+                        })
+                        .filter(c -> c.getName().startsWith("org.apache.camel.")));
+    }
+
+    // CHECKSTYLE:OFF
+    private JavaClass generateWriter(List<Class<?>> model, ClassLoader classLoader) {
+        JavaClass writer = new JavaClass(classLoader);
+        writer.setMaxImportPerPackage(4);
+        writer.setPackage(WRITER_PACKAGE);
+        writer.setName("ModelWriter");
+        writer.extendSuperType("BaseWriter");
+        writer.addImport(MODEL_PACKAGE + ".OptionalIdentifiedDefinition");
+        writer.addImport(IOException.class);
+        writer.addImport(Array.class);
+        writer.addImport(List.class);
+        writer.addImport(ArrayList.class);
+        writer.addAnnotation(SuppressWarnings.class).setLiteralValue("\"all\"");
+
+        writer.addMethod()
+                .setConstructor(true)
+                .setPublic()
+                .setName("ModelWriter")
+                .addParameter(Writer.class, "writer")
+                .addParameter(String.class, "namespace")
+                .addThrows(IOException.class)
+                .setBody(
+                        "super(writer, namespace);");
+        writer.addMethod()
+                .setConstructor(true)
+                .setPublic()
+                .setName("ModelWriter")
+                .addParameter(Writer.class, "writer")
+                .addThrows(IOException.class)
+                .setBody("super(writer, null);");
+
+        List<Class<?>> rootElements = model.stream().filter(this::isRootElement).toList();
+
+        for (Class<?> clazz : rootElements) {
+            String element = clazz.getAnnotation(XmlRootElement.class).name();
+            String name = clazz.getSimpleName();
+            writer.addMethod().setPublic()
+                    .addParameter(clazz, "def")
+                    .setReturnType(Void.TYPE)
+                    .setName("write" + name)
+                    .addThrows(IOException.class)
+                    .setBody(
+                            "doWrite" + name + "(\"" + element + "\", def);"
+                    );
+
+        }
+
+        Set<Class<?>> elementRefs = new TreeSet<>(Comparator.comparing(Class::getName));
+
+        for (Class<?> clazz : model) {
+            if (clazz.getAnnotation(XmlEnum.class) != null || clazz.isInterface()) {
+                continue;
+            }
+            String name = clazz.getSimpleName();
+            String qname;
+            if (clazz.getDeclaringClass() != null) {
+                writer.addImport(clazz.getDeclaringClass());
+                qname = clazz.getDeclaringClass().getSimpleName() + "." + name;
+            } else {
+                writer.addImport(clazz);
+                qname = name;
+            }
+            boolean hasDerived = model.stream().anyMatch(cl -> cl.getSuperclass() == clazz);
+
+            List<Property> members = getProperties(clazz).toList();
+
+            // XmlAttribute
+            List<String> attributes = new ArrayList<>();
+            // call super class attributes writer
+            getClassAndSuper(clazz.getSuperclass())
+                    .filter(c -> getProperties(c).anyMatch(Property::isAttribute))
+                    .findFirst()
+                    .ifPresent(cl -> attributes.add("doWrite" + cl.getSimpleName() + "Attributes(def);"));
+            // Add attributes
+            List<Property> attributeMembers = members.stream().filter(Property::isAttribute).toList();
+            attributeMembers.forEach(member -> {
+                Type pt = member.getType();
+                GenericType type = new GenericType(pt);
+                String an = member.getAnnotation(XmlAttribute.class).name();
+                if ("##default".equals(an)) {
+                    an = member.getName();
+                }
+                String gn = member.getGetter();
+                attributes.add("doWriteAttribute(\"" + an + "\", " + conversion(writer, type, "def." + gn + "()", clazz.getName()) + ");");
+            });
+
+            // @XmlAnyAttribute
+            members.stream().filter(Property::isAnyAttribute).forEach(member -> {
+                throw new UnsupportedOperationException("Class " + clazz.getName() + " / member " + member + ": unsupported @XmlAnyAttribute");
+            });
+
+            List<String> elements = new ArrayList<>();
+            // Add super class element writer
+            getClassAndSuper(clazz.getSuperclass())
+                    .filter(c -> getProperties(c).anyMatch(Property::isElement))
+                    .findFirst()
+                    .ifPresent(cl -> elements.add("doWrite" + cl.getSimpleName() + "Elements(def);"));
+            // Loop through elements
+            List<Property> elementMembers = members.stream().filter(Property::isElement).toList();
+            elementMembers.forEach(member -> {
+                Type pt = member.getType();
+                GenericType type = new GenericType(pt);
+                boolean list = type.getRawClass() == List.class;
+                String gn = member.getGetter();
+                String pn = member.getName();
+                Class<?> root = list ? type.getActualTypeArgument(0).getRawClass() : type.getRawClass();
+                if (member.getAnnotation(XmlElementRefs.class) != null) {
+                    elements.add("// TODO: @XmlElementRefs: " + member);
+                } else if (member.getAnnotation(XmlElementRef.class) != null) {
+                    //elements.add("// @XmlElementRef: " + member);
+                    if (list) {
+                        Class<?> parent = new GenericType(member.getType()).getActualTypeArgument(0).getRawClass();
+                        elementRefs.add(parent);
+                        elements.add("doWriteList(null, null, def." + gn + "(), this::doWrite" + parent.getSimpleName() + "Ref);");
+                    } else {
+                        Class<?> parent = new GenericType(member.getType()).getRawClass();
+                        elementRefs.add(parent);
+                        elements.add("doWriteElement(null, def." + gn + "(), this::doWrite" + parent.getSimpleName() + "Ref);");
+                    }
+                } else if (member.getAnnotation(XmlElements.class) != null) {
+                    if (list) {
+                        // elements.add("// @XmlElements: " + member);
+                        elements.add("doWriteList(null, null, def." + gn + "(), (n, v) -> {");
+                        elements.add("    switch (v.getClass().getSimpleName()) {");
+                        for (XmlElement elem : member.getAnnotation(XmlElements.class).value()) {
+                            String t = elem.type().getSimpleName();
+                            String n = elem.name();
+                            elements.add("        case \"" + t + "\" -> doWrite" + t + "(\"" + n + "\", (" + t + ") v);");
+                        }
+                        elements.add("    }");
+                        elements.add("});");
+                    } else {
+                        // elements.add("// @XmlElements: " + member);
+                        elements.add("doWriteElement(null, def." + gn + "(), (n, v) -> {");
+                        elements.add("    switch (v.getClass().getSimpleName()) {");
+                        for (XmlElement elem : member.getAnnotation(XmlElements.class).value()) {
+                            String t = elem.type().getSimpleName();
+                            String n = elem.name();
+                            elements.add("        case \"" + t + "\" -> doWrite" + t + "(\"" + n + "\", (" + t + ") def." + gn + "());");
+                        }
+                        elements.add("    }");
+                        elements.add("});");
+                    }
+                } else if (member.getAnnotation(XmlElement.class) != null) {
+                    String t = root.getSimpleName();
+                    String n = member.getAnnotation(XmlElement.class).name();
+                    if ("##default".equals(n)) {
+                        n = pn;
+                    }
+                    // elements.add("// @XmlElement: " + member);
+                    if (list) {
+                        String w = member.getAnnotation(XmlElementWrapper.class) != null
+                                ? member.getAnnotation(XmlElementWrapper.class).name() : null;
+                        elements.add("doWriteList(" + (w != null ? "\"" + w + "\"" : "null") + ", " +
+                                "\"" + n + "\", def." + gn + "(), this::doWrite" + t + ");");
+                    } else {
+                        elements.add("doWriteElement(" +
+                                "\"" + n + "\", def." + gn + "(), this::doWrite" + t + ");");
+                    }
+                } else {
+                    String t = root.getSimpleName();
+                    String n = root.getAnnotation(XmlRootElement.class) != null
+                            ? root.getAnnotation(XmlRootElement.class).name() : "##default";
+                    if ("##default".equals(n)) {
+                        // TODO: handle default name
+                    }
+                    // elements.add("// " + member);
+                    if (list) {
+                        elements.add("doWriteList(\"" + pn + "\", " +
+                                "\"" + n + "\", def." + gn + "(), this::doWrite" + t + ");");
+                    } else {
+                        elements.add("doWriteElement(\"" + pn + "\", def." + gn + "(), this::doWrite" + t + ");");
+                    }
+                }
+            });
+
+            // @XmlValue
+            List<String> value =
+                    getClassAndSuper(clazz).flatMap(this::getProperties)
+                            .filter(Property::isValue).findFirst()
+                    .map(member -> "doWriteValue(def." + member.getGetter() + "());")
+                    .stream().toList();
+
+            String qgname = qname;
+            if (clazz.getTypeParameters().length > 0) {
+                qgname = qname + "<" + Stream.of(clazz.getTypeParameters()).map(t -> "?")
+                        .collect(Collectors.joining(", ")) + ">";
+            }
+            if (!attributeMembers.isEmpty() || !elementMembers.isEmpty() || isRootElement(clazz)
+                    || isReferenced(clazz, model)) {
+                List<String> statements = new ArrayList<>();
+                statements.add("startElement(name);");
+                // Attributes
+                if (hasDerived && !attributes.isEmpty()) {
+                    writer.addMethod()
+                            .setReturnType(Void.TYPE)
+                            .setName("doWrite" + name + "Attributes")
+                            .addParameter(qgname, "def")
+                            .addThrows(IOException.class)
+                            .setBody(String.join("\n", attributes));
+                    statements.add("doWrite" + name + "Attributes(def);");
+                } else {
+                    statements.addAll(attributes);
+                }
+                // Value
+                statements.addAll(value);
+                // Elements
+                if (hasDerived && !elements.isEmpty()) {
+                    writer.addMethod()
+                            .setReturnType(Void.TYPE)
+                            .setName("doWrite" + name + "Elements")
+                            .addParameter(qgname, "def")
+                            .addThrows(IOException.class)
+                            .setBody(String.join("\n", elements));
+                    statements.add("doWrite" + name + "Elements(def);");
+                } else {
+                    statements.addAll(elements);
+                }
+                statements.add("endElement();");
+                writer.addMethod()
+                        .setProtected()
+                        .setReturnType(Void.TYPE)
+                        .setName("doWrite" + name)
+                        .addParameter(String.class, "name")
+                        .addParameter(qgname, "def")
+                        .addThrows(IOException.class)
+                        .setBody(String.join("\n", statements));
+            }
+        }
+
+        elementRefs.forEach(clazz -> {
+            List<String> elements = new ArrayList<>();
+            elements.add("if (v != null) {");
+            elements.add("    switch (v.getClass().getSimpleName()) {");
+            model.stream()
+                    .filter(c -> c.getAnnotation(XmlRootElement.class) != null)
+                    .filter(c -> getClassAndSuper(c).anyMatch(cl -> cl == clazz))
+                    .forEach(cl -> {
+                        String t = cl.getSimpleName();
+                        String n = cl.getAnnotation(XmlRootElement.class).name();
+                        elements.add("        case \"" + t + "\" -> doWrite" + t + "(\"" + n + "\", (" + t + ") v);");
+                    });
+            elements.add("    }");
+            elements.add("}");
+            String qname = clazz.getSimpleName();
+            if (clazz.getTypeParameters().length > 0) {
+                qname = qname + "<" + Stream.of(clazz.getTypeParameters()).map(t -> "?")
+                        .collect(Collectors.joining(", ")) + ">";
+            }
+            writer.addMethod()
+                    .setReturnType(Void.TYPE)
+                    .setName("doWrite" + clazz.getSimpleName() + "Ref")
+                    .addParameter("String", "n")
+                    .addParameter(qname, "v")
+                    .addThrows(IOException.class)
+                    .setBody(String.join("\n", elements));
+        });
+
+        writer.addMethod()
+                .setReturnType(Void.TYPE)
+                .setName("doWriteAttribute")
+                .addParameter(String.class, "attribute")
+                .addParameter(String.class, "value")
+                .addThrows(IOException.class)
+                .setBody("if (value != null) {",
+                        "    attribute(attribute, value);",
+                        "}");
+        writer.addMethod()
+                .setReturnType(Void.TYPE)
+                .setName("doWriteValue")
+                .addParameter(String.class, "value")
+                .addThrows(IOException.class)
+                .setBody("if (value != null) {",
+                        "    text(value);",
+                        "}");
+        writer.addMethod()
+                .setSignature("private <T> void doWriteList(String wrapperName, String name, List<T> list, ElementSerializer<T> elementSerializer) throws IOException")
+                .setBody("""
+                            if (list != null) {
+                                if (wrapperName != null) {
+                                    startElement(wrapperName);
+                                }
+                                for (T v : list) {
+                                    elementSerializer.doWriteElement(name, v);
+                                }
+                                if (wrapperName != null) {
+                                    endElement();
+                                }
+                            }""");
+        writer.addMethod()
+                .setSignature("private <T> void doWriteElement(String name, T v, ElementSerializer<T> elementSerializer) throws IOException")
+                .setBody("""
+                            if (v != null) {
+                                elementSerializer.doWriteElement(name, v);
+                            }""");
+        writer.addNestedType()
+                .setClass(false)
+                .setAbstract(true)
+                .setName("ElementSerializer<T>")
+                .addMethod()
+                        .setAbstract()
+                        .setSignature("void doWriteElement(String name, T value) throws IOException");
+
+        writer.addMethod()
+                .setReturnType(String.class)
+                .setName("toString")
+                .addParameter("Boolean", "b")
+                .setBody("return b != null ? b.toString() : null;");
+        writer.addMethod()
+                .setReturnType(String.class)
+                .setName("toString")
+                .addParameter("Enum<?>", "e")
+                .setBody("return e != null ? e.name() : null;");
+        writer.addMethod()
+                .setReturnType(String.class)
+                .setName("toString")
+                .addParameter("Number", "n")
+                .setBody("return n != null ? n.toString() : null;");
+        writer.addImport("java.util.Base64");
+        writer.addMethod()
+                .setReturnType(String.class)
+                .setName("toString")
+                .addParameter("byte[]", "b")
+                .setBody("return b != null ? Base64.getEncoder().encodeToString(b) : null;");
+
+        writer.addMethod()
+                .setReturnType(Void.TYPE)
+                .setName("doWriteString")
+                .addParameter(String.class, "name")
+                .addParameter(String.class, "value")
+                .addThrows(IOException.class)
+                .setBody("if (value != null) {",
+                        "    startElement(name);",
+                        "    text(value);",
+                        "    endElement();",
+                        "}");
+
+        return writer;
+    }
+
+    private boolean isReferenced(Class<?> clazz, List<Class<?>> model) {
+        return model.stream()
+                .flatMap(this::getProperties)
+                .anyMatch(p -> {
+                    GenericType t = new GenericType(p.getType());
+                    Class<?> cl = t.getRawClass() == List.class ? t.getActualTypeArgument(0).getRawClass() : t.getRawClass();
+                    return cl == clazz;
+                });
+    }
+
+    private String conversion(JavaClass writer, GenericType type, String val, String clazzName) {
+        Class<?> rawClass = type.getRawClass();
+        if (rawClass == String.class) {
+            return val;
+        } else if (rawClass.isEnum()
+                || rawClass == Integer.class || rawClass == Long.class || rawClass == Boolean.class
+                || rawClass == Float.class) {
+            writer.addImport(rawClass);
+            return "toString(" + val + ")";
+        } else if (rawClass == byte[].class) {
+            return "toString(" + val + ")";
+        } else {
+            throw new UnsupportedOperationException("Unsupported type " + rawClass.getSimpleName() + " in class " + clazzName);
+        }
+    }
+
+    class Property {
+        private final Member field;
+        private final Member getter;
+        private final Member setter;
+        private final String name;
+        private final Type type;
+
+        public Property(Member field, Member getter, Member setter, String name, Type type) {
+            this.field = field;
+            this.getter = getter;
+            this.setter = setter;
+            this.name = name;
+            this.type = type;
+        }
+
+        @Override
+        public String toString() {
+            return "Property{" +
+                    "name='" + name + '\'' +
+                    ", type=" + type +
+                    ", field=" + field +
+                    ", getter=" + getter +
+                    ", setter=" + setter +
+                    '}';
+        }
+
+        private Stream<Member> members() {
+            return Stream.of(field, getter, setter).filter(Objects::nonNull);
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public Type getType() {
+            return type;
+        }
+
+        public String getGetter() {
+            return Optional.ofNullable(getter)
+                    .orElseThrow(() -> new IllegalArgumentException("No getter for property defined by " + members().toList()))
+                    .getName();
+        }
+
+        public String getSetter() {
+            return Optional.ofNullable(setter)
+                    .orElseThrow(() -> new IllegalArgumentException("No setter for property defined by " + members().toList()))
+                    .getName();
+        }
+
+        @SuppressWarnings("unchecked")
+        public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+            return (T) annotations().filter(annotationClass::isInstance).findFirst().orElse(null);
+        }
+
+        public <T extends Annotation> boolean hasAnnotation(Class<T> annotationClass) {
+            return getAnnotation(annotationClass) != null;
+        }
+
+        private Stream<? extends Annotation> annotations() {
+            return members().flatMap(m -> Stream.of(((AnnotatedElement) m).getAnnotations()));
+
+        }
+
+        public boolean isAttribute() {
+            return hasAnnotation(XmlAttribute.class);
+        }
+
+        public boolean isAnyAttribute() {
+            return hasAnnotation(XmlAnyAttribute.class);
+        }
+
+        public boolean isValue() {
+            return hasAnnotation(XmlValue.class);
+        }
+
+        public boolean isElement() {
+            return !isAttribute() && !isAnyAttribute() && !isValue();
+        }
+
+        public boolean isElementRefs() {
+            return hasAnnotation(XmlElementRefs.class);
+        }
+
+        public boolean isElementRef() {
+            return hasAnnotation(XmlElementRef.class);
+            // || member.getDeclaringClass() == outputDefinitionClass && "setOutputs".equals(member.getName());
+        }
+    }
+
+    private static Type type(Member member) {
+        return member instanceof Method
+                ? member.getName().startsWith("set")
+                        ? ((Method) member).getGenericParameterTypes()[0]
+                        : ((Method) member).getGenericReturnType()
+                : ((Field) member).getGenericType();
+    }
+
+    private Map<Class<?>, List<Property>> properties = new ConcurrentHashMap<>();
+    private Stream<Property> getProperties(Class<?> clazz) {
+        return properties.computeIfAbsent(clazz, cl -> doGetProperties(cl)).stream();
+    }
+    private List<Property> doGetProperties(Class<?> clazz) {
+        List<Member> allMembers = getClassAndSuper(clazz)
+                .flatMap(cl -> getMembers(clazz).stream())
+                .toList();
+        Stream<Property> properties = allMembers.stream()
+                .filter(accessible(clazz))
+                .collect(Collectors.groupingBy(this::propname))
+                .entrySet()
+                .stream()
+                .map(l -> {
+                    List<Member> members = l.getValue();
+                    if (!members.stream().allMatch(this::isNotTransient)) {
+                        return null;
+                    }
+                    String name = l.getKey();
+                    Type type = type(members.get(0));
+                    Member field = members.stream()
+                            .filter(this::isField)
+                            .findFirst().or(() -> allMembers.stream()
+                                    .filter(m -> isField(m)
+                                            && Objects.equals(propname(m), name)
+                                            && Objects.equals(type(m), type))
+                                    .findFirst())
+                            .orElse(null);
+                    Member getter = members.stream()
+                            .filter(this::isGetter)
+                            .findFirst().or(() -> allMembers.stream()
+                                    .filter(m -> isGetter(m)
+                                            && Objects.equals(propname(m), name)
+                                            && Objects.equals(type(m), type))
+                                    .findFirst())
+                            .orElse(null);
+                    Member setter = members.stream()
+                            .filter(this::isSetter)
+                            .findFirst().or(() -> allMembers.stream()
+                                    .filter(m -> isSetter(m)
+                                            && Objects.equals(propname(m), name)
+                                            && Objects.equals(type(m), type))
+                                    .findFirst())
+                            .orElse(null);
+                    if (getter != null && setter != null) {
+                        return new Property(field, getter, setter, name, type);
+                    } else {
+                        if (field != null && isXmlBindAnnotated(field)) {
+                            getLog().warn("Unsupported annotated field: " + field);
+                        }
+                        if (getter != null && isXmlBindAnnotated(getter)) {
+                            getLog().warn("Unsupported annotated getter: " + getter);
+                        }
+                        if (setter != null && isXmlBindAnnotated(setter)) {
+                            getLog().warn("Unsupported annotated setter: " + setter);
+                        }
+                        return null;
+                    }
+                })
+                .filter(Objects::nonNull);
+        XmlType xmlType = clazz.getAnnotation(XmlType.class);
+        if (xmlType != null) {
+            String[] propOrder = xmlType.propOrder();
+            if (propOrder != null && propOrder.length > 0) {
+                properties = properties
+                        .sorted(Comparator.comparing(p -> Arrays.binarySearch(propOrder, p.getName())));
+            }
+        }
+        return properties.toList();
+    }
+
+    private Map<Class<?>, List<Member>> members = new ConcurrentHashMap<>();
+    private List<Member> getMembers(Class<?> clazz) {
+        return members.computeIfAbsent(clazz, cl -> Stream.<Member>concat(
+                    Arrays.stream(cl.getDeclaredMethods())
+                        .filter(m -> isSetter(m) || isGetter(m))
+                        .filter(m -> !m.isSynthetic()),
+                    Arrays.stream(cl.getDeclaredFields()))
+                .toList());
+    }
+
+    private Predicate<Member> accessible(Class<?> clazz) {
+        XmlAccessType accessType;
+        if (clazz.getAnnotation(XmlAccessorType.class) != null) {
+            accessType = clazz.getAnnotation(XmlAccessorType.class).value();
+        } else {
+            accessType = XmlAccessType.PUBLIC_MEMBER;
+        }
+        if (accessType == XmlAccessType.PROPERTY) {
+            return m -> m.getDeclaringClass() == clazz
+                    && isSetter(m) || isGetter(m) || (isField(m) && isXmlBindAnnotated(m));
+        } else if (accessType == XmlAccessType.FIELD) {
+            return m -> m.getDeclaringClass() == clazz
+                    && ((isSetter(m) || isGetter(m)) && isXmlBindAnnotated(m)
+                            || isField(m) && !Modifier.isStatic(m.getModifiers()) && !Modifier.isTransient(m.getModifiers()));
+        } else if (accessType == XmlAccessType.PUBLIC_MEMBER) {
+            return m -> m.getDeclaringClass() == clazz
+                    && (Modifier.isPublic(m.getModifiers()) || isXmlBindAnnotated(m));
+        } else /* if (accessType == XmlAccessType.NONE) */ {
+            return m -> m.getDeclaringClass() == clazz
+                    && isXmlBindAnnotated(m);
+        }
+    }
+
+    private boolean isXmlBindAnnotated(Member m) {
+        return Stream.of(((AnnotatedElement) m).getAnnotations())
+                .anyMatch(a -> a.getClass().getAnnotatedInterfaces()[0].getType().getTypeName().startsWith("jakarta.xml.bind.annotation."));
+    }
+
+    private boolean isField(Member member) {
+        return member instanceof Field;
+    }
+
+    private boolean isSetter(Member member) {
+        return (member instanceof Method m)
+                && !Modifier.isStatic(m.getModifiers())
+                && m.getName().startsWith("set") && m.getName().length() > 3
+                && m.getParameterCount() == 1
+                && m.getReturnType() == Void.TYPE;
+    }
+
+    private boolean isGetter(Member member) {
+        return (member instanceof Method m)
+                && !Modifier.isStatic(m.getModifiers())
+                && m.getParameterCount() == 0
+                && (m.getName().startsWith("get") && m.getName().length() > 3
+                        || m.getName().startsWith("is") && m.getName().length() > 2
+                                && (m.getReturnType() == Boolean.TYPE || m.getReturnType() == Boolean.class));
+    }
+
+    private Stream<Class<?>> getClassAndSuper(Class<?> clazz) {
+        return clazz != Object.class && clazz != null
+                ? Stream.concat(Stream.of(clazz), getClassAndSuper(clazz.getSuperclass()))
+                : Stream.empty();
+    }
+
+    private String propname(Member member) {
+        String name = member.getName();
+        if (member instanceof Method) {
+            if (name.startsWith("is") && name.length() > 2) {
+                return lowercase(name.substring(2));
+            } else if ((name.startsWith("get") || name.startsWith("set")) && name.length() > 3) {
+                return lowercase(name.substring(3));
+            }
+        } else if (member instanceof Field) {
+            return name;
+        }
+        throw new IllegalArgumentException("Unable to determine property name for: " + member);
+    }
+
+    private boolean isNotTransient(Member member) {
+        return ((AnnotatedElement) member).getAnnotation(XmlTransient.class) == null;
+    }
+
+    private boolean isRootElement(Class<?> clazz) {
+        return clazz.getAnnotation(XmlRootElement.class) != null;
+    }
+
+    private String lowercase(String fn) {
+        return fn.substring(0, 1).toLowerCase() + fn.substring(1);
+    }
+
+    private String uppercase(String fn) {
+        return fn.substring(0, 1).toUpperCase() + fn.substring(1);
+    }
+
+}


[camel] 02/02: [CAMEL-18305] New lightweight ModelToXMLDumper

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 701a15a2094116836c6fe49fc46f946086c8bb0c
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Feb 8 16:12:53 2023 +0100

    [CAMEL-18305] New lightweight ModelToXMLDumper
---
 core/camel-core/pom.xml                            |   4 +
 .../java/org/apache/camel/xml/out/ModelWriter.java | 173 +++++++------
 .../services/org/apache/camel/modelxml-dumper      |   2 +
 .../org/apache/camel/xml/LwModelToXMLDumper.java   | 268 +++++++++++++++++++++
 .../java/org/apache/camel/xml/io/XMLWriter.java    |  49 +---
 .../java/org/apache/camel/xml/out/BaseWriter.java  |   6 +-
 .../packaging/ModelXmlWriterGeneratorMojo.java     |  15 ++
 7 files changed, 405 insertions(+), 112 deletions(-)

diff --git a/core/camel-core/pom.xml b/core/camel-core/pom.xml
index 7ed136fd9f0..d8ccffda633 100644
--- a/core/camel-core/pom.xml
+++ b/core/camel-core/pom.xml
@@ -146,6 +146,10 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-xslt</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-xml-io</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-xml-jaxb</artifactId>
diff --git a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
index 3f89b8b860e..074f96a8d56 100644
--- a/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
+++ b/core/camel-xml-io/src/generated/java/org/apache/camel/xml/out/ModelWriter.java
@@ -1059,14 +1059,14 @@ public class ModelWriter extends BaseWriter {
         doWriteOptionalIdentifiedDefinitionElements(def);
         endElement();
     }
-    void doWriteBeanFactoryDefinitionAttributes(
+    protected void doWriteBeanFactoryDefinitionAttributes(
             BeanFactoryDefinition<?, ?> def)
             throws IOException {
         doWriteAttribute("name", def.getName());
         doWriteAttribute("type", def.getType());
         doWriteAttribute("beanType", def.getBeanType());
     }
-    void doWriteBeanFactoryDefinitionElements(
+    protected void doWriteBeanFactoryDefinitionElements(
             BeanFactoryDefinition<?, ?> def)
             throws IOException {
         doWriteElement("script", def.getScript(), this::doWriteString);
@@ -1154,7 +1154,7 @@ public class ModelWriter extends BaseWriter {
         doWriteOptionalIdentifiedDefinitionElements(def);
         endElement();
     }
-    void doWriteDataFormatDefinitionAttributes(
+    protected void doWriteDataFormatDefinitionAttributes(
             DataFormatDefinition def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
@@ -1234,10 +1234,14 @@ public class ModelWriter extends BaseWriter {
         });
         endElement();
     }
-    void doWriteExpressionNodeAttributes(ExpressionNode def) throws IOException {
+    protected void doWriteExpressionNodeAttributes(
+            ExpressionNode def)
+            throws IOException {
         doWriteProcessorDefinitionAttributes(def);
     }
-    void doWriteExpressionNodeElements(ExpressionNode def) throws IOException {
+    protected void doWriteExpressionNodeElements(
+            ExpressionNode def)
+            throws IOException {
         doWriteOptionalIdentifiedDefinitionElements(def);
         doWriteElement(null, def.getExpression(), this::doWriteExpressionDefinitionRef);
     }
@@ -1258,7 +1262,7 @@ public class ModelWriter extends BaseWriter {
         doWriteElement(null, def.getExpressionType(), this::doWriteExpressionDefinitionRef);
         endElement();
     }
-    void doWriteFaultToleranceConfigurationCommonAttributes(
+    protected void doWriteFaultToleranceConfigurationCommonAttributes(
             FaultToleranceConfigurationCommon def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
@@ -1353,7 +1357,9 @@ public class ModelWriter extends BaseWriter {
         doWriteOutputExpressionNodeElements(def);
         endElement();
     }
-    void doWriteIdentifiedTypeAttributes(IdentifiedType def) throws IOException {
+    protected void doWriteIdentifiedTypeAttributes(
+            IdentifiedType def)
+            throws IOException {
         doWriteAttribute("id", def.getId());
     }
     protected void doWriteIdentifiedType(
@@ -1393,12 +1399,12 @@ public class ModelWriter extends BaseWriter {
         doWriteOptionalIdentifiedDefinitionElements(def);
         endElement();
     }
-    void doWriteInterceptDefinitionAttributes(
+    protected void doWriteInterceptDefinitionAttributes(
             InterceptDefinition def)
             throws IOException {
         doWriteProcessorDefinitionAttributes(def);
     }
-    void doWriteInterceptDefinitionElements(
+    protected void doWriteInterceptDefinitionElements(
             InterceptDefinition def)
             throws IOException {
         doWriteOptionalIdentifiedDefinitionElements(def);
@@ -1468,7 +1474,7 @@ public class ModelWriter extends BaseWriter {
         });
         endElement();
     }
-    void doWriteLoadBalancerDefinitionAttributes(
+    protected void doWriteLoadBalancerDefinitionAttributes(
             LoadBalancerDefinition def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
@@ -1641,13 +1647,13 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("maximumRetryDelay", def.getMaximumRetryDelay());
         endElement();
     }
-    void doWriteOptionalIdentifiedDefinitionAttributes(
+    protected void doWriteOptionalIdentifiedDefinitionAttributes(
             OptionalIdentifiedDefinition<?> def)
             throws IOException {
         doWriteAttribute("id", def.getId());
         doWriteAttribute("customId", toString(def.getCustomId()));
     }
-    void doWriteOptionalIdentifiedDefinitionElements(
+    protected void doWriteOptionalIdentifiedDefinitionElements(
             OptionalIdentifiedDefinition<?> def)
             throws IOException {
         doWriteElement("description", def.getDescription(), this::doWriteDescriptionDefinition);
@@ -1671,12 +1677,12 @@ public class ModelWriter extends BaseWriter {
         doWriteList(null, null, def.getOutputs(), this::doWriteProcessorDefinitionRef);
         endElement();
     }
-    void doWriteOutputExpressionNodeAttributes(
+    protected void doWriteOutputExpressionNodeAttributes(
             OutputExpressionNode def)
             throws IOException {
         doWriteProcessorDefinitionAttributes(def);
     }
-    void doWriteOutputExpressionNodeElements(
+    protected void doWriteOutputExpressionNodeElements(
             OutputExpressionNode def)
             throws IOException {
         doWriteExpressionNodeElements(def);
@@ -1770,14 +1776,14 @@ public class ModelWriter extends BaseWriter {
         doWriteOptionalIdentifiedDefinitionElements(def);
         endElement();
     }
-    void doWriteProcessorDefinitionAttributes(
+    protected void doWriteProcessorDefinitionAttributes(
             ProcessorDefinition<?> def)
             throws IOException {
         doWriteOptionalIdentifiedDefinitionAttributes(def);
         doWriteAttribute("inheritErrorHandler", toString(def.isInheritErrorHandler()));
         doWriteAttribute("disabled", def.getDisabled());
     }
-    void doWriteProcessorDefinitionElements(
+    protected void doWriteProcessorDefinitionElements(
             ProcessorDefinition<?> def)
             throws IOException {
         doWriteOptionalIdentifiedDefinitionElements(def);
@@ -1931,7 +1937,7 @@ public class ModelWriter extends BaseWriter {
         });
         endElement();
     }
-    void doWriteResilience4jConfigurationCommonAttributes(
+    protected void doWriteResilience4jConfigurationCommonAttributes(
             Resilience4jConfigurationCommon def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
@@ -1949,7 +1955,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("slidingWindowType", def.getSlidingWindowType());
         doWriteAttribute("waitDurationInOpenState", def.getWaitDurationInOpenState());
     }
-    void doWriteResilience4jConfigurationCommonElements(
+    protected void doWriteResilience4jConfigurationCommonElements(
             Resilience4jConfigurationCommon def)
             throws IOException {
         doWriteElement("bulkheadMaxWaitDuration", def.getBulkheadMaxWaitDuration(), this::doWriteString);
@@ -2208,13 +2214,15 @@ public class ModelWriter extends BaseWriter {
         doWriteExpressionNodeElements(def);
         endElement();
     }
-    void doWriteSendDefinitionAttributes(
+    protected void doWriteSendDefinitionAttributes(
             SendDefinition<?> def)
             throws IOException {
         doWriteProcessorDefinitionAttributes(def);
         doWriteAttribute("uri", def.getUri());
     }
-    void doWriteSendDefinitionElements(SendDefinition<?> def) throws IOException {
+    protected void doWriteSendDefinitionElements(
+            SendDefinition<?> def)
+            throws IOException {
         doWriteOptionalIdentifiedDefinitionElements(def);
     }
     protected void doWriteSendDefinition(
@@ -2428,7 +2436,7 @@ public class ModelWriter extends BaseWriter {
         doWriteOptionalIdentifiedDefinitionElements(def);
         endElement();
     }
-    void doWriteToDynamicDefinitionAttributes(
+    protected void doWriteToDynamicDefinitionAttributes(
             ToDynamicDefinition def)
             throws IOException {
         doWriteProcessorDefinitionAttributes(def);
@@ -2439,7 +2447,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("allowOptimisedComponents", def.getAllowOptimisedComponents());
         doWriteAttribute("uri", def.getUri());
     }
-    void doWriteToDynamicDefinitionElements(
+    protected void doWriteToDynamicDefinitionElements(
             ToDynamicDefinition def)
             throws IOException {
         doWriteOptionalIdentifiedDefinitionElements(def);
@@ -2735,12 +2743,12 @@ public class ModelWriter extends BaseWriter {
         doWriteServiceCallConfigurationElements(def);
         endElement();
     }
-    void doWriteServiceCallConfigurationAttributes(
+    protected void doWriteServiceCallConfigurationAttributes(
             ServiceCallConfiguration def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
     }
-    void doWriteServiceCallConfigurationElements(
+    protected void doWriteServiceCallConfigurationElements(
             ServiceCallConfiguration def)
             throws IOException {
         doWriteList(null, "properties", def.getProperties(), this::doWritePropertyDefinition);
@@ -2862,12 +2870,12 @@ public class ModelWriter extends BaseWriter {
         doWriteServiceCallConfigurationElements(def);
         endElement();
     }
-    void doWriteServiceCallServiceDiscoveryConfigurationAttributes(
+    protected void doWriteServiceCallServiceDiscoveryConfigurationAttributes(
             ServiceCallServiceDiscoveryConfiguration def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
     }
-    void doWriteServiceCallServiceDiscoveryConfigurationElements(
+    protected void doWriteServiceCallServiceDiscoveryConfigurationElements(
             ServiceCallServiceDiscoveryConfiguration def)
             throws IOException {
         doWriteServiceCallConfigurationElements(def);
@@ -2881,12 +2889,12 @@ public class ModelWriter extends BaseWriter {
         doWriteServiceCallServiceDiscoveryConfigurationElements(def);
         endElement();
     }
-    void doWriteServiceCallServiceFilterConfigurationAttributes(
+    protected void doWriteServiceCallServiceFilterConfigurationAttributes(
             ServiceCallServiceFilterConfiguration def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
     }
-    void doWriteServiceCallServiceFilterConfigurationElements(
+    protected void doWriteServiceCallServiceFilterConfigurationElements(
             ServiceCallServiceFilterConfiguration def)
             throws IOException {
         doWriteServiceCallConfigurationElements(def);
@@ -2900,12 +2908,12 @@ public class ModelWriter extends BaseWriter {
         doWriteServiceCallServiceFilterConfigurationElements(def);
         endElement();
     }
-    void doWriteServiceCallServiceLoadBalancerConfigurationAttributes(
+    protected void doWriteServiceCallServiceLoadBalancerConfigurationAttributes(
             ServiceCallServiceLoadBalancerConfiguration def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
     }
-    void doWriteServiceCallServiceLoadBalancerConfigurationElements(
+    protected void doWriteServiceCallServiceLoadBalancerConfigurationElements(
             ServiceCallServiceLoadBalancerConfiguration def)
             throws IOException {
         doWriteServiceCallConfigurationElements(def);
@@ -3183,7 +3191,9 @@ public class ModelWriter extends BaseWriter {
         });
         endElement();
     }
-    void doWriteFhirDataformatAttributes(FhirDataformat def) throws IOException {
+    protected void doWriteFhirDataformatAttributes(
+            FhirDataformat def)
+            throws IOException {
         doWriteIdentifiedTypeAttributes(def);
         doWriteAttribute("contentTypeHeader", def.getContentTypeHeader());
         doWriteAttribute("dontStripVersionsFromReferencesAtPaths", def.getDontStripVersionsFromReferencesAtPaths());
@@ -3531,7 +3541,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("dataObjectType", def.getDataObjectTypeName());
         endElement();
     }
-    void doWriteUniVocityAbstractDataFormatAttributes(
+    protected void doWriteUniVocityAbstractDataFormatAttributes(
             UniVocityAbstractDataFormat def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
@@ -3549,7 +3559,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("comment", def.getComment());
         doWriteAttribute("numberOfRecordsToRead", def.getNumberOfRecordsToRead());
     }
-    void doWriteUniVocityAbstractDataFormatElements(
+    protected void doWriteUniVocityAbstractDataFormatElements(
             UniVocityAbstractDataFormat def)
             throws IOException {
         doWriteList(null, null, def.getHeaders(), this::doWriteUniVocityHeaderRef);
@@ -3688,7 +3698,7 @@ public class ModelWriter extends BaseWriter {
         doWriteDefaultErrorHandlerDefinitionElements(def);
         endElement();
     }
-    void doWriteDefaultErrorHandlerDefinitionAttributes(
+    protected void doWriteDefaultErrorHandlerDefinitionAttributes(
             DefaultErrorHandlerDefinition def)
             throws IOException {
         doWriteIdentifiedTypeAttributes(def);
@@ -3704,7 +3714,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("onExceptionOccurredRef", def.getOnExceptionOccurredRef());
         doWriteAttribute("redeliveryPolicyRef", def.getRedeliveryPolicyRef());
     }
-    void doWriteDefaultErrorHandlerDefinitionElements(
+    protected void doWriteDefaultErrorHandlerDefinitionElements(
             DefaultErrorHandlerDefinition def)
             throws IOException {
         doWriteElement("redeliveryPolicy", def.getRedeliveryPolicy(), this::doWriteRedeliveryPolicyDefinition);
@@ -3753,14 +3763,14 @@ public class ModelWriter extends BaseWriter {
         doWriteDefaultErrorHandlerDefinitionElements(def);
         endElement();
     }
-    void doWriteTransactionErrorHandlerDefinitionAttributes(
+    protected void doWriteTransactionErrorHandlerDefinitionAttributes(
             TransactionErrorHandlerDefinition def)
             throws IOException {
         doWriteDefaultErrorHandlerDefinitionAttributes(def);
         doWriteAttribute("rollbackLoggingLevel", def.getRollbackLoggingLevel());
         doWriteAttribute("transactedPolicyRef", def.getTransactedPolicyRef());
     }
-    void doWriteTransactionErrorHandlerDefinitionElements(
+    protected void doWriteTransactionErrorHandlerDefinitionElements(
             TransactionErrorHandlerDefinition def)
             throws IOException {
         doWriteDefaultErrorHandlerDefinitionElements(def);
@@ -3812,7 +3822,7 @@ public class ModelWriter extends BaseWriter {
         doWriteValue(def.getExpression());
         endElement();
     }
-    void doWriteExpressionDefinitionAttributes(
+    protected void doWriteExpressionDefinitionAttributes(
             ExpressionDefinition def)
             throws IOException {
         doWriteAttribute("trim", def.getTrim());
@@ -3930,12 +3940,12 @@ public class ModelWriter extends BaseWriter {
         doWriteValue(def.getExpression());
         endElement();
     }
-    void doWriteNamespaceAwareExpressionAttributes(
+    protected void doWriteNamespaceAwareExpressionAttributes(
             NamespaceAwareExpression def)
             throws IOException {
         doWriteSingleInputExpressionDefinitionAttributes(def);
     }
-    void doWriteNamespaceAwareExpressionElements(
+    protected void doWriteNamespaceAwareExpressionElements(
             NamespaceAwareExpression def)
             throws IOException {
         doWriteList(null, "namespace", def.getNamespace(), this::doWritePropertyDefinition);
@@ -3986,7 +3996,7 @@ public class ModelWriter extends BaseWriter {
         doWriteValue(def.getExpression());
         endElement();
     }
-    void doWriteSingleInputExpressionDefinitionAttributes(
+    protected void doWriteSingleInputExpressionDefinitionAttributes(
             SingleInputExpressionDefinition def)
             throws IOException {
         doWriteExpressionDefinitionAttributes(def);
@@ -4002,7 +4012,7 @@ public class ModelWriter extends BaseWriter {
         doWriteValue(def.getExpression());
         endElement();
     }
-    void doWriteSingleInputTypedExpressionDefinitionAttributes(
+    protected void doWriteSingleInputTypedExpressionDefinitionAttributes(
             SingleInputTypedExpressionDefinition def)
             throws IOException {
         doWriteTypedExpressionDefinitionAttributes(def);
@@ -4045,7 +4055,7 @@ public class ModelWriter extends BaseWriter {
         doWriteValue(def.getExpression());
         endElement();
     }
-    void doWriteTypedExpressionDefinitionAttributes(
+    protected void doWriteTypedExpressionDefinitionAttributes(
             TypedExpressionDefinition def)
             throws IOException {
         doWriteExpressionDefinitionAttributes(def);
@@ -4426,7 +4436,7 @@ public class ModelWriter extends BaseWriter {
         });
         endElement();
     }
-    void doWriteRestSecurityDefinitionAttributes(
+    protected void doWriteRestSecurityDefinitionAttributes(
             RestSecurityDefinition def)
             throws IOException {
         doWriteAttribute("description", def.getDescription());
@@ -4459,7 +4469,9 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("key", def.getKey());
         endElement();
     }
-    void doWriteVerbDefinitionAttributes(VerbDefinition def) throws IOException {
+    protected void doWriteVerbDefinitionAttributes(
+            VerbDefinition def)
+            throws IOException {
         doWriteOptionalIdentifiedDefinitionAttributes(def);
         doWriteAttribute("enableCORS", def.getEnableCORS());
         doWriteAttribute("deprecated", def.getDeprecated());
@@ -4475,7 +4487,9 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("disabled", def.getDisabled());
         doWriteAttribute("consumes", def.getConsumes());
     }
-    void doWriteVerbDefinitionElements(VerbDefinition def) throws IOException {
+    protected void doWriteVerbDefinitionElements(
+            VerbDefinition def)
+            throws IOException {
         doWriteOptionalIdentifiedDefinitionElements(def);
         doWriteList(null, null, def.getParams(), this::doWriteParamDefinitionRef);
         doWriteList(null, null, def.getSecurity(), this::doWriteSecurityDefinitionRef);
@@ -4562,7 +4576,7 @@ public class ModelWriter extends BaseWriter {
         doWriteAttribute("uri", def.getUri());
         endElement();
     }
-    void doWriteTransformerDefinitionAttributes(
+    protected void doWriteTransformerDefinitionAttributes(
             TransformerDefinition def)
             throws IOException {
         doWriteAttribute("toType", def.getToType());
@@ -4620,7 +4634,7 @@ public class ModelWriter extends BaseWriter {
         doWriteElement(null, def.getExpression(), this::doWriteExpressionDefinitionRef);
         endElement();
     }
-    void doWriteValidatorDefinitionAttributes(
+    protected void doWriteValidatorDefinitionAttributes(
             ValidatorDefinition def)
             throws IOException {
         doWriteAttribute("type", def.getType());
@@ -4647,14 +4661,17 @@ public class ModelWriter extends BaseWriter {
         });
         endElement();
     }
-    void doWriteFromDefinitionRef(String n, FromDefinition v) throws IOException {
+    protected void doWriteFromDefinitionRef(
+            String n,
+            FromDefinition v)
+            throws IOException {
         if (v != null) {
             switch (v.getClass().getSimpleName()) {
                 case "FromDefinition" -> doWriteFromDefinition("from", (FromDefinition) v);
             }
         }
     }
-    void doWriteInputTypeDefinitionRef(
+    protected void doWriteInputTypeDefinitionRef(
             String n,
             InputTypeDefinition v)
             throws IOException {
@@ -4664,7 +4681,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteOutputTypeDefinitionRef(
+    protected void doWriteOutputTypeDefinitionRef(
             String n,
             OutputTypeDefinition v)
             throws IOException {
@@ -4674,7 +4691,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteProcessorDefinitionRef(
+    protected void doWriteProcessorDefinitionRef(
             String n,
             ProcessorDefinition<?> v)
             throws IOException {
@@ -4750,7 +4767,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteRouteConfigurationDefinitionRef(
+    protected void doWriteRouteConfigurationDefinitionRef(
             String n,
             RouteConfigurationDefinition v)
             throws IOException {
@@ -4760,7 +4777,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteRouteDefinitionRef(
+    protected void doWriteRouteDefinitionRef(
             String n,
             RouteDefinition v)
             throws IOException {
@@ -4770,7 +4787,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteRouteTemplateDefinitionRef(
+    protected void doWriteRouteTemplateDefinitionRef(
             String n,
             RouteTemplateDefinition v)
             throws IOException {
@@ -4780,7 +4797,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteTemplatedRouteDefinitionRef(
+    protected void doWriteTemplatedRouteDefinitionRef(
             String n,
             TemplatedRouteDefinition v)
             throws IOException {
@@ -4790,14 +4807,17 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteWhenDefinitionRef(String n, WhenDefinition v) throws IOException {
+    protected void doWriteWhenDefinitionRef(
+            String n,
+            WhenDefinition v)
+            throws IOException {
         if (v != null) {
             switch (v.getClass().getSimpleName()) {
                 case "WhenDefinition" -> doWriteWhenDefinition("when", (WhenDefinition) v);
             }
         }
     }
-    void doWriteUniVocityHeaderRef(
+    protected void doWriteUniVocityHeaderRef(
             String n,
             UniVocityHeader v)
             throws IOException {
@@ -4807,7 +4827,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteExpressionDefinitionRef(
+    protected void doWriteExpressionDefinitionRef(
             String n,
             ExpressionDefinition v)
             throws IOException {
@@ -4817,7 +4837,7 @@ public class ModelWriter extends BaseWriter {
                 case "ConstantExpression" -> doWriteConstantExpression("constant", (ConstantExpression) v);
                 case "DatasonnetExpression" -> doWriteDatasonnetExpression("datasonnet", (DatasonnetExpression) v);
                 case "ExchangePropertyExpression" -> doWriteExchangePropertyExpression("exchangeProperty", (ExchangePropertyExpression) v);
-                case "ExpressionDefinition" -> doWriteExpressionDefinition("##default", (ExpressionDefinition) v);
+                case "ExpressionDefinition" -> doWriteExpressionDefinition("expressionDefinition", (ExpressionDefinition) v);
                 case "GroovyExpression" -> doWriteGroovyExpression("groovy", (GroovyExpression) v);
                 case "HeaderExpression" -> doWriteHeaderExpression("header", (HeaderExpression) v);
                 case "Hl7TerserExpression" -> doWriteHl7TerserExpression("hl7terser", (Hl7TerserExpression) v);
@@ -4840,7 +4860,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteParamDefinitionRef(
+    protected void doWriteParamDefinitionRef(
             String n,
             ParamDefinition v)
             throws IOException {
@@ -4850,7 +4870,7 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteResponseMessageDefinitionRef(
+    protected void doWriteResponseMessageDefinitionRef(
             String n,
             ResponseMessageDefinition v)
             throws IOException {
@@ -4860,14 +4880,17 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteRestDefinitionRef(String n, RestDefinition v) throws IOException {
+    protected void doWriteRestDefinitionRef(
+            String n,
+            RestDefinition v)
+            throws IOException {
         if (v != null) {
             switch (v.getClass().getSimpleName()) {
                 case "RestDefinition" -> doWriteRestDefinition("rest", (RestDefinition) v);
             }
         }
     }
-    void doWriteSecurityDefinitionRef(
+    protected void doWriteSecurityDefinitionRef(
             String n,
             SecurityDefinition v)
             throws IOException {
@@ -4877,7 +4900,10 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteVerbDefinitionRef(String n, VerbDefinition v) throws IOException {
+    protected void doWriteVerbDefinitionRef(
+            String n,
+            VerbDefinition v)
+            throws IOException {
         if (v != null) {
             switch (v.getClass().getSimpleName()) {
                 case "DeleteDefinition" -> doWriteDeleteDefinition("delete", (DeleteDefinition) v);
@@ -4889,12 +4915,15 @@ public class ModelWriter extends BaseWriter {
             }
         }
     }
-    void doWriteAttribute(String attribute, String value) throws IOException {
+    protected void doWriteAttribute(
+            String attribute,
+            String value)
+            throws IOException {
         if (value != null) {
             attribute(attribute, value);
         }
     }
-    void doWriteValue(String value) throws IOException {
+    protected void doWriteValue(String value) throws IOException {
         if (value != null) {
             text(value);
         }
@@ -4917,19 +4946,19 @@ public class ModelWriter extends BaseWriter {
             elementSerializer.doWriteElement(name, v);
         }
     }
-    String toString(Boolean b) {
+    protected String toString(Boolean b) {
         return b != null ? b.toString() : null;
     }
-    String toString(Enum<?> e) {
+    protected String toString(Enum<?> e) {
         return e != null ? e.name() : null;
     }
-    String toString(Number n) {
+    protected String toString(Number n) {
         return n != null ? n.toString() : null;
     }
-    String toString(byte[] b) {
+    protected String toString(byte[] b) {
         return b != null ? Base64.getEncoder().encodeToString(b) : null;
     }
-    void doWriteString(String name, String value) throws IOException {
+    protected void doWriteString(String name, String value) throws IOException {
         if (value != null) {
             startElement(name);
             text(value);
diff --git a/core/camel-xml-io/src/generated/resources/META-INF/services/org/apache/camel/modelxml-dumper b/core/camel-xml-io/src/generated/resources/META-INF/services/org/apache/camel/modelxml-dumper
new file mode 100644
index 00000000000..6150df7d1c2
--- /dev/null
+++ b/core/camel-xml-io/src/generated/resources/META-INF/services/org/apache/camel/modelxml-dumper
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.xml.LwModelToXMLDumper
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java
new file mode 100644
index 00000000000..3e6d9b25685
--- /dev/null
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/LwModelToXMLDumper.java
@@ -0,0 +1,268 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.xml;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.function.Consumer;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.DelegateEndpoint;
+import org.apache.camel.Endpoint;
+import org.apache.camel.Expression;
+import org.apache.camel.NamedNode;
+import org.apache.camel.model.ExpressionNode;
+import org.apache.camel.model.FromDefinition;
+import org.apache.camel.model.OptionalIdentifiedDefinition;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.model.RouteTemplateDefinition;
+import org.apache.camel.model.RouteTemplatesDefinition;
+import org.apache.camel.model.RoutesDefinition;
+import org.apache.camel.model.SendDefinition;
+import org.apache.camel.model.ToDynamicDefinition;
+import org.apache.camel.model.language.ExpressionDefinition;
+import org.apache.camel.spi.ModelToXMLDumper;
+import org.apache.camel.spi.NamespaceAware;
+import org.apache.camel.spi.annotations.JdkService;
+import org.apache.camel.util.KeyValueHolder;
+import org.apache.camel.xml.out.ModelWriter;
+
+import static org.apache.camel.model.ProcessorDefinitionHelper.filterTypeInOutputs;
+
+/**
+ * Lightweight {@link ModelToXMLDumper} based on the generated {@link ModelWriter}.
+ */
+@JdkService(ModelToXMLDumper.FACTORY)
+public class LwModelToXMLDumper implements ModelToXMLDumper {
+
+    @Override
+    public String dumpModelAsXml(CamelContext context, NamedNode definition) throws Exception {
+        return dumpModelAsXml(context, definition, false, false);
+    }
+
+    @Override
+    public String dumpModelAsXml(
+            CamelContext context, NamedNode definition, boolean resolvePlaceholders, boolean resolveDelegateEndpoints)
+            throws Exception {
+
+        Properties properties = new Properties();
+        Map<String, String> namespaces = new LinkedHashMap<>();
+        Map<String, KeyValueHolder<Integer, String>> locations = new HashMap<>();
+        Consumer<RouteDefinition> extractor = route -> {
+            extractNamespaces(route, namespaces);
+            if (context.isDebugging()) {
+                extractSourceLocations(route, locations);
+            }
+            resolveEndpointDslUris(route);
+            if (Boolean.TRUE.equals(route.isTemplate())) {
+                Map<String, Object> parameters = route.getTemplateParameters();
+                if (parameters != null) {
+                    properties.putAll(parameters);
+                }
+            }
+        };
+
+        StringWriter buffer = new StringWriter();
+        ModelWriter writer = new ModelWriter(buffer, "http://camel.apache.org/schema/spring") {
+            @Override
+            protected void doWriteOptionalIdentifiedDefinitionAttributes(OptionalIdentifiedDefinition<?> def)
+                    throws IOException {
+                // write customId if not false
+                if (Boolean.TRUE.equals(def.getCustomId())) {
+                    doWriteAttribute("customId", toString(def.getCustomId()));
+                }
+                // write id
+                doWriteAttribute("id", def.getId());
+                // write location information
+                if (context.isDebugging()) {
+                    String id = def.getId();
+                    String loc = (def instanceof RouteDefinition ? ((RouteDefinition) def).getInput() : def).getLocation();
+                    int line = (def instanceof RouteDefinition ? ((RouteDefinition) def).getInput() : def).getLineNumber();
+                    if (line != -1) {
+                        writer.addAttribute("sourceLineNumber", Integer.toString(line));
+                        writer.addAttribute("sourceLocation", loc);
+                    }
+                }
+            }
+
+            @Override
+            protected void startElement(String name) throws IOException {
+                boolean namespaceWritten = this.namespaceWritten;
+                super.startElement(name);
+                if (!namespaceWritten) {
+                    for (Map.Entry<String, String> entry : namespaces.entrySet()) {
+                        // TODO: check duplicate xmlns="xxx" attribute ?
+                        String nsPrefix = entry.getKey();
+                        String prefix = nsPrefix.equals("xmlns") ? nsPrefix : "xmlns:" + nsPrefix;
+                        writer.addAttribute(prefix, entry.getValue());
+                    }
+                }
+            }
+
+            @Override
+            protected void doWriteValue(String value) throws IOException {
+                if (value != null && !value.isEmpty()) {
+                    super.doWriteValue(value);
+                }
+            }
+
+            @Override
+            protected void text(String text) throws IOException {
+                if (resolvePlaceholders) {
+                    text = resolve(text, properties);
+                }
+                super.text(text);
+            }
+
+            @Override
+            protected void attribute(String name, String value) throws IOException {
+                if (resolveDelegateEndpoints && "uri".equals(name)) {
+                    String uri = resolve(value, properties);
+                    Endpoint endpoint = context.hasEndpoint(uri);
+                    if (endpoint instanceof DelegateEndpoint) {
+                        endpoint = ((DelegateEndpoint) endpoint).getEndpoint();
+                        value = endpoint.getEndpointUri();
+                    }
+                }
+                if (resolvePlaceholders) {
+                    value = resolve(value, properties);
+                }
+                super.attribute(name, value);
+            }
+
+            String resolve(String value, Properties properties) {
+                context.getPropertiesComponent().setLocalProperties(properties);
+                try {
+                    return context.resolvePropertyPlaceholders(value);
+                } catch (Exception e) {
+                    return value;
+                } finally {
+                    // clear local after the route is dumped
+                    context.getPropertiesComponent().setLocalProperties(null);
+                }
+            }
+        };
+
+        // gather all namespaces from the routes or route which is stored on the expression nodes
+        if (definition instanceof RouteTemplatesDefinition templates) {
+            templates.getRouteTemplates().forEach(template -> extractor.accept(template.getRoute()));
+            writer.writeRouteTemplatesDefinition(templates);
+        } else if (definition instanceof RouteTemplateDefinition template) {
+            extractor.accept(template.getRoute());
+            writer.writeRouteTemplateDefinition(template);
+        } else if (definition instanceof RoutesDefinition routes) {
+            routes.getRoutes().forEach(extractor);
+            writer.writeRoutesDefinition(routes);
+        } else if (definition instanceof RouteDefinition route) {
+            extractor.accept(route);
+            writer.writeRouteDefinition(route);
+        }
+
+        return buffer.toString();
+    }
+
+    /**
+     * Extract all XML namespaces from the expressions in the route
+     *
+     * @param route      the route
+     * @param namespaces the map of namespaces to add discovered XML namespaces into
+     */
+    private static void extractNamespaces(RouteDefinition route, Map<String, String> namespaces) {
+        Collection<ExpressionNode> col = filterTypeInOutputs(route.getOutputs(), ExpressionNode.class);
+        for (ExpressionNode en : col) {
+            NamespaceAware na = getNamespaceAwareFromExpression(en);
+            if (na != null) {
+                Map<String, String> map = na.getNamespaces();
+                if (map != null && !map.isEmpty()) {
+                    namespaces.putAll(map);
+                }
+            }
+        }
+    }
+
+    /**
+     * Extract all source locations from the route
+     *
+     * @param route     the route
+     * @param locations the map of source locations for EIPs in the route
+     */
+    private static void extractSourceLocations(RouteDefinition route, Map<String, KeyValueHolder<Integer, String>> locations) {
+        // input
+        String id = route.getRouteId();
+        String loc = route.getInput().getLocation();
+        int line = route.getInput().getLineNumber();
+        if (id != null && line != -1) {
+            locations.put(id, new KeyValueHolder<>(line, loc));
+        }
+        // and then walk all nodes in the route graphs
+        for (var def : filterTypeInOutputs(route.getOutputs(), OptionalIdentifiedDefinition.class)) {
+            id = def.getId();
+            loc = def.getLocation();
+            line = def.getLineNumber();
+            if (id != null && line != -1) {
+                locations.put(id, new KeyValueHolder<>(line, loc));
+            }
+        }
+    }
+
+    /**
+     * If the route has been built with endpoint-dsl, then the model will not have uri set which then cannot be included
+     * in the JAXB model dump
+     */
+    @SuppressWarnings("rawtypes")
+    private static void resolveEndpointDslUris(RouteDefinition route) {
+        FromDefinition from = route.getInput();
+        if (from != null && from.getEndpointConsumerBuilder() != null) {
+            String uri = from.getEndpointConsumerBuilder().getRawUri();
+            from.setUri(uri);
+        }
+        Collection<SendDefinition> col = filterTypeInOutputs(route.getOutputs(), SendDefinition.class);
+        for (SendDefinition<?> to : col) {
+            if (to.getEndpointProducerBuilder() != null) {
+                String uri = to.getEndpointProducerBuilder().getRawUri();
+                to.setUri(uri);
+            }
+        }
+        Collection<ToDynamicDefinition> col2 = filterTypeInOutputs(route.getOutputs(), ToDynamicDefinition.class);
+        for (ToDynamicDefinition to : col2) {
+            if (to.getEndpointProducerBuilder() != null) {
+                String uri = to.getEndpointProducerBuilder().getRawUri();
+                to.setUri(uri);
+            }
+        }
+    }
+
+    private static NamespaceAware getNamespaceAwareFromExpression(ExpressionNode expressionNode) {
+        ExpressionDefinition ed = expressionNode.getExpression();
+
+        NamespaceAware na = null;
+        Expression exp = ed.getExpressionValue();
+        if (exp instanceof NamespaceAware) {
+            na = (NamespaceAware) exp;
+        } else if (ed instanceof NamespaceAware) {
+            na = (NamespaceAware) ed;
+        }
+
+        return na;
+    }
+
+}
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java
index bdce1b84984..943bb9ff678 100644
--- a/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/io/XMLWriter.java
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.io.Writer;
 import java.util.ArrayDeque;
 import java.util.Deque;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 /**
@@ -28,12 +27,6 @@ import java.util.regex.Pattern;
  */
 public class XMLWriter {
 
-    private static final Pattern AMP = Pattern.compile("&");
-    private static final Pattern LT = Pattern.compile("<");
-    private static final Pattern GT = Pattern.compile(">");
-    private static final Pattern DQUOTE = Pattern.compile("\"");
-    private static final Pattern SQUOTE = Pattern.compile("\'");
-    private static final Pattern CRLF = Pattern.compile("\r\n");
     private static final Pattern LOWERS = Pattern.compile("([\000-\037])");
 
     private final Writer writer;
@@ -91,7 +84,7 @@ public class XMLWriter {
     public XMLWriter(Writer writer, String lineIndenter, String lineSeparator,
                      String encoding, String doctype) throws IOException {
         this.writer = writer;
-        this.lineIndenter = lineIndenter != null ? lineIndenter : "  ";
+        this.lineIndenter = lineIndenter != null ? lineIndenter : "    ";
         this.lineSeparator = validateLineSeparator(lineSeparator);
         this.encoding = encoding;
         this.docType = doctype;
@@ -177,39 +170,21 @@ public class XMLWriter {
     }
 
     private static String escapeXml(String text) {
-        if (text.indexOf('&') >= 0) {
-            text = AMP.matcher(text).replaceAll("&amp;");
-        }
-        if (text.indexOf('<') >= 0) {
-            text = LT.matcher(text).replaceAll("&lt;");
-        }
-        if (text.indexOf('>') >= 0) {
-            text = GT.matcher(text).replaceAll("&gt;");
-        }
-        if (text.indexOf('"') >= 0) {
-            text = DQUOTE.matcher(text).replaceAll("&quot;");
-        }
-        if (text.indexOf('\'') >= 0) {
-            text = SQUOTE.matcher(text).replaceAll("&apos;");
-        }
-
-        return text;
+        return text
+                .replace("&", "&amp;")
+                .replace("<", "&lt;")
+                .replace(">", "&gt;");
     }
 
     private static String escapeXmlAttribute(String text) {
-        text = escapeXml(text);
-
+        text = escapeXml(text)
+                .replace("\"", "&quot;")
+                .replace("'", "&apos;");
         // Windows
-        text = CRLF.matcher(text).replaceAll("&#10;");
-
-        StringBuilder b = new StringBuilder();
-        Matcher m = LOWERS.matcher(text);
-        while (m.find()) {
-            m.appendReplacement(b, "&#" + Integer.toString(m.group(1).charAt(0)) + ";");
-        }
-        m.appendTail(b);
-
-        return b.toString();
+        text = text.replace("\r\n", "&#10;");
+        // Non printable characters
+        text = LOWERS.matcher(text).replaceAll(r -> "&#" + Integer.toString(r.group(1).charAt(0)) + ";");
+        return text;
     }
 
     /**
diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java
index ba4cf52a033..ade6d9418d5 100644
--- a/core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java
+++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/out/BaseWriter.java
@@ -23,9 +23,9 @@ import org.apache.camel.xml.io.XMLWriter;
 
 public class BaseWriter {
 
-    private final XMLWriter writer;
-    private final String namespace;
-    private boolean namespaceWritten;
+    protected final XMLWriter writer;
+    protected final String namespace;
+    protected boolean namespaceWritten;
 
     public BaseWriter(Writer writer, String namespace) throws IOException {
         this.writer = new XMLWriter(writer);
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java
index a833b9baebc..dbb76d1f48e 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/ModelXmlWriterGeneratorMojo.java
@@ -396,6 +396,7 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                 // Attributes
                 if (hasDerived && !attributes.isEmpty()) {
                     writer.addMethod()
+                            .setProtected()
                             .setReturnType(Void.TYPE)
                             .setName("doWrite" + name + "Attributes")
                             .addParameter(qgname, "def")
@@ -410,6 +411,7 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                 // Elements
                 if (hasDerived && !elements.isEmpty()) {
                     writer.addMethod()
+                            .setProtected()
                             .setReturnType(Void.TYPE)
                             .setName("doWrite" + name + "Elements")
                             .addParameter(qgname, "def")
@@ -441,6 +443,9 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                     .forEach(cl -> {
                         String t = cl.getSimpleName();
                         String n = cl.getAnnotation(XmlRootElement.class).name();
+                        if ("##default".equals(n)) {
+                            n = lowercase(t);
+                        }
                         elements.add("        case \"" + t + "\" -> doWrite" + t + "(\"" + n + "\", (" + t + ") v);");
                     });
             elements.add("    }");
@@ -451,6 +456,7 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                         .collect(Collectors.joining(", ")) + ">";
             }
             writer.addMethod()
+                    .setProtected()
                     .setReturnType(Void.TYPE)
                     .setName("doWrite" + clazz.getSimpleName() + "Ref")
                     .addParameter("String", "n")
@@ -460,6 +466,7 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
         });
 
         writer.addMethod()
+                .setProtected()
                 .setReturnType(Void.TYPE)
                 .setName("doWriteAttribute")
                 .addParameter(String.class, "attribute")
@@ -469,6 +476,7 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                         "    attribute(attribute, value);",
                         "}");
         writer.addMethod()
+                .setProtected()
                 .setReturnType(Void.TYPE)
                 .setName("doWriteValue")
                 .addParameter(String.class, "value")
@@ -477,6 +485,7 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                         "    text(value);",
                         "}");
         writer.addMethod()
+                .setProtected()
                 .setSignature("private <T> void doWriteList(String wrapperName, String name, List<T> list, ElementSerializer<T> elementSerializer) throws IOException")
                 .setBody("""
                             if (list != null) {
@@ -491,6 +500,7 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                                 }
                             }""");
         writer.addMethod()
+                .setProtected()
                 .setSignature("private <T> void doWriteElement(String name, T v, ElementSerializer<T> elementSerializer) throws IOException")
                 .setBody("""
                             if (v != null) {
@@ -505,28 +515,33 @@ public class ModelXmlWriterGeneratorMojo extends AbstractGeneratorMojo {
                         .setSignature("void doWriteElement(String name, T value) throws IOException");
 
         writer.addMethod()
+                .setProtected()
                 .setReturnType(String.class)
                 .setName("toString")
                 .addParameter("Boolean", "b")
                 .setBody("return b != null ? b.toString() : null;");
         writer.addMethod()
+                .setProtected()
                 .setReturnType(String.class)
                 .setName("toString")
                 .addParameter("Enum<?>", "e")
                 .setBody("return e != null ? e.name() : null;");
         writer.addMethod()
+                .setProtected()
                 .setReturnType(String.class)
                 .setName("toString")
                 .addParameter("Number", "n")
                 .setBody("return n != null ? n.toString() : null;");
         writer.addImport("java.util.Base64");
         writer.addMethod()
+                .setProtected()
                 .setReturnType(String.class)
                 .setName("toString")
                 .addParameter("byte[]", "b")
                 .setBody("return b != null ? Base64.getEncoder().encodeToString(b) : null;");
 
         writer.addMethod()
+                .setProtected()
                 .setReturnType(Void.TYPE)
                 .setName("doWriteString")
                 .addParameter(String.class, "name")