You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by jp...@apache.org on 2018/07/23 12:10:59 UTC

[camel] branch master updated: Add parsing options to FHIR dataformats

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7d59ef2  Add parsing options to FHIR dataformats
7d59ef2 is described below

commit 7d59ef22b9a52cc70754cc96fe813bec39d17bdd
Author: jpoth <po...@gmail.com>
AuthorDate: Wed Jul 18 13:16:24 2018 +0200

    Add parsing options to FHIR dataformats
---
 .../org/apache/camel/builder/DataFormatClause.java |  26 ++
 .../camel/model/dataformat/FhirDataformat.java     | 468 +++++++++++++++++++++
 .../camel/model/dataformat/FhirJsonDataFormat.java |  47 +--
 .../camel/model/dataformat/FhirXmlDataFormat.java  |  49 +--
 .../src/main/docs/fhirJson-dataformat.adoc         |  14 +-
 .../src/main/docs/fhirXml-dataformat.adoc          |  14 +-
 .../camel/component/fhir/FhirDataFormat.java       | 262 ++++++++++++
 .../camel/component/fhir/FhirJsonDataFormat.java   |  62 +--
 .../camel/component/fhir/FhirXmlDataFormat.java    |  62 +--
 .../{ => dataformat}/FhirJsonDataFormatTest.java   |   2 +-
 .../FhirJsonDataformatErrorHandlerTest.java        | 104 +++++
 .../{ => dataformat}/FhirXmlDataFormatTest.java    |   2 +-
 .../FhirXmlDataformatErrorHandlerTest.java         | 103 +++++
 .../spring/FhirDataformatConfigSpringTest.java     |  98 +++++
 .../FhirDataformatDefaultConfigSpringTest.java     |  82 ++++
 .../spring}/FhirJsonDataFormatSpringTest.java      |   2 +-
 .../FhirJsonDataformatErrorHandlerSpringTest.java} |  58 +--
 .../spring}/FhirXmlDataFormatSpringTest.java       |   2 +-
 .../FhirXmlDataformatErrorHandlerSpringTest.java}  |  57 +--
 .../fhir/FhirDataFormatConfigSpringTest.xml        | 132 ++++++
 ...l => FhirDataFormatDefaultConfigSpringTest.xml} |  17 +-
 ...> FhirJsonDataFormatErrorHandlerSpringTest.xml} |  29 +-
 .../fhir/json/FhirJsonDataFormatSpringTest.xml     |   2 +-
 .../FhirXmlDataFormatErrorHandlerSpringTest.xml}   |  29 +-
 .../FhirJsonDataFormatConfiguration.java           | 201 +++++++++
 .../springboot/FhirXmlDataFormatConfiguration.java | 201 +++++++++
 26 files changed, 1816 insertions(+), 309 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
index f9c3b6d..f29ba8c 100644
--- a/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
+++ b/camel-core/src/main/java/org/apache/camel/builder/DataFormatClause.java
@@ -1264,6 +1264,19 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
         return dataFormat(jsonDataFormat);
     }
 
+    public T fhirJson(boolean prettyPrint) {
+        FhirJsonDataFormat jsonDataFormat = new FhirJsonDataFormat();
+        jsonDataFormat.setPrettyPrint(prettyPrint);
+        return dataFormat(jsonDataFormat);
+    }
+
+    public T fhirJson(String version, boolean prettyPrint) {
+        FhirJsonDataFormat jsonDataFormat = new FhirJsonDataFormat();
+        jsonDataFormat.setPrettyPrint(prettyPrint);
+        jsonDataFormat.setFhirVersion(version);
+        return dataFormat(jsonDataFormat);
+    }
+
     /**
      * Uses the FHIR XML data format
      */
@@ -1278,6 +1291,19 @@ public class DataFormatClause<T extends ProcessorDefinition<?>> {
         return dataFormat(fhirXmlDataFormat);
     }
 
+    public T fhirXml(boolean prettyPrint) {
+        FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat();
+        fhirXmlDataFormat.setPrettyPrint(prettyPrint);
+        return dataFormat(fhirXmlDataFormat);
+    }
+
+    public T fhirXml(String version, boolean prettyPrint) {
+        FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat();
+        fhirXmlDataFormat.setFhirVersion(version);
+        fhirXmlDataFormat.setPrettyPrint(prettyPrint);
+        return dataFormat(fhirXmlDataFormat);
+    }
+
     @SuppressWarnings("unchecked")
     private T dataFormat(DataFormatDefinition dataFormatType) {
         switch (operation) {
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirDataformat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirDataformat.java
new file mode 100644
index 0000000..2c327e3
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirDataformat.java
@@ -0,0 +1,468 @@
+/**
+ * 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.model.dataformat;
+
+import java.util.List;
+import java.util.Set;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlTransient;
+import org.apache.camel.CamelContext;
+import org.apache.camel.model.DataFormatDefinition;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.util.ObjectHelper;
+
+public abstract class FhirDataformat extends DataFormatDefinition {
+    @XmlTransient
+    @Metadata(label = "advanced")
+    private Object fhirContext;
+
+    @XmlAttribute
+    @Metadata(enums = "DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4", defaultValue = "DSTU3")
+    private String fhirVersion;
+
+    @XmlAttribute
+    private Boolean prettyPrint;
+
+    @XmlTransient
+    @Metadata(label = "advanced")
+    private Object parserErrorHandler;
+
+    @XmlTransient
+    @Metadata(label = "advanced")
+    private Object parserOptions;
+
+    @XmlTransient
+    @Metadata(label = "advanced")
+    private Object preferTypes;
+
+    @XmlTransient
+    @Metadata(label = "advanced")
+    private Object forceResourceId;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private String serverBaseUrl;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Boolean omitResourceId;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Set<String> encodeElementsAppliesToResourceTypes;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Boolean encodeElementsAppliesToChildResourcesOnly;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Set<String> encodeElements;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Set<String> dontEncodeElements;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Boolean stripVersionsFromReferences;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Boolean overrideResourceIdWithBundleEntryFullUrl;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Boolean summaryMode;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private Boolean suppressNarratives;
+
+    @XmlAttribute
+    @Metadata(label = "advanced")
+    private List<String> dontStripVersionsFromReferencesAtPaths;
+
+    protected FhirDataformat(String dataFormatName) {
+        super(dataFormatName);
+    }
+
+    protected FhirDataformat() {
+        // This constructor is needed by jaxb for schema generation
+    }
+
+
+
+    @Override
+    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
+        if (getContentTypeHeader() != null) {
+            setProperty(camelContext, dataFormat, "contentTypeHeader", getContentTypeHeader());
+        }
+        if (getFhirContext() != null) {
+            setProperty(camelContext, dataFormat, "fhirContext", getFhirContext());
+        }
+        if (getFhirVersion() != null) {
+            setProperty(camelContext, dataFormat, "fhirVersion", getFhirVersion());
+        }
+        if (ObjectHelper.isNotEmpty(getDontStripVersionsFromReferencesAtPaths())) {
+            setProperty(camelContext, dataFormat, "dontStripVersionsFromReferencesAtPaths", getDontStripVersionsFromReferencesAtPaths());
+        }
+        if (ObjectHelper.isNotEmpty(getDontEncodeElements())) {
+            setProperty(camelContext, dataFormat, "dontEncodeElements", getDontEncodeElements());
+        }
+        if (ObjectHelper.isNotEmpty(getEncodeElements())) {
+            setProperty(camelContext, dataFormat, "encodeElements", getEncodeElements());
+        }
+        if (ObjectHelper.isNotEmpty(getEncodeElementsAppliesToResourceTypes())) {
+            setProperty(camelContext, dataFormat, "encodeElementsAppliesToResourceTypes", getEncodeElementsAppliesToResourceTypes());
+        }
+        if (ObjectHelper.isNotEmpty(getServerBaseUrl())) {
+            setProperty(camelContext, dataFormat, "serverBaseUrl", getServerBaseUrl());
+        }
+        if (ObjectHelper.isNotEmpty(getForceResourceId())) {
+            setProperty(camelContext, dataFormat, "forceResourceId", getForceResourceId());
+        }
+        if (ObjectHelper.isNotEmpty(getPreferTypes())) {
+            setProperty(camelContext, dataFormat, "preferTypes", getPreferTypes());
+        }
+        if (ObjectHelper.isNotEmpty(getParserOptions())) {
+            setProperty(camelContext, dataFormat, "parserOptions", getParserOptions());
+        }
+        if (ObjectHelper.isNotEmpty(getParserErrorHandler())) {
+            setProperty(camelContext, dataFormat, "parserErrorHandler", getParserErrorHandler());
+        }
+
+        Boolean answer = ObjectHelper.toBoolean(isEncodeElementsAppliesToChildResourcesOnly());
+        if (answer != null) {
+            setProperty(camelContext, dataFormat, "encodeElementsAppliesToChildResourcesOnly", answer);
+        }
+        answer = ObjectHelper.toBoolean(isOmitResourceId());
+        if (answer != null) {
+            setProperty(camelContext, dataFormat, "omitResourceId", answer);
+        }
+        answer = ObjectHelper.toBoolean(isPrettyPrint());
+        if (answer != null) {
+            setProperty(camelContext, dataFormat, "prettyPrint", answer);
+        }
+        answer = ObjectHelper.toBoolean(isSuppressNarratives());
+        if (answer != null) {
+            setProperty(camelContext, dataFormat, "suppressNarratives", answer);
+        }
+        answer = ObjectHelper.toBoolean(isSummaryMode());
+        if (answer != null) {
+            setProperty(camelContext, dataFormat, "summaryMode", answer);
+        }
+        answer = ObjectHelper.toBoolean(getOverrideResourceIdWithBundleEntryFullUrl());
+        if (answer != null) {
+            setProperty(camelContext, dataFormat, "overrideResourceIdWithBundleEntryFullUrl", answer);
+        }
+        answer = ObjectHelper.toBoolean(getStripVersionsFromReferences());
+        if (answer != null) {
+            setProperty(camelContext, dataFormat, "stripVersionsFromReferences", answer);
+        }
+    }
+
+    public Object getFhirContext() {
+        return fhirContext;
+    }
+
+    public void setFhirContext(Object fhirContext) {
+        this.fhirContext = fhirContext;
+    }
+
+    public String getFhirVersion() {
+        return fhirVersion;
+    }
+
+    /**
+     * The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4
+     */
+    public void setFhirVersion(String fhirVersion) {
+        this.fhirVersion = fhirVersion;
+    }
+
+    public Boolean isPrettyPrint() {
+        return prettyPrint;
+    }
+
+    /**
+     * Sets the "pretty print" flag, meaning that the parser will encode resources with human-readable spacing and
+     * newlines between elements instead of condensing output as much as possible.
+     *
+     * @param prettyPrint The flag
+     */
+    public void setPrettyPrint(Boolean prettyPrint) {
+        this.prettyPrint = prettyPrint;
+    }
+
+    public Object getParserErrorHandler() {
+        return parserErrorHandler;
+    }
+
+    /**
+     * Registers an error handler which will be invoked when any parse errors are found
+     *
+     * @param parserErrorHandler The error handler to set. Must not be null.
+     */
+    public void setParserErrorHandler(Object parserErrorHandler) {
+        this.parserErrorHandler = parserErrorHandler;
+    }
+
+    public Object getParserOptions() {
+        return parserOptions;
+    }
+
+    /**
+     * Sets the parser options object which will be used to supply default
+     * options to newly created parsers.
+     *
+     * @param parserOptions The parser options object
+     */
+    public void setParserOptions(Object parserOptions) {
+        this.parserOptions = parserOptions;
+    }
+
+    public Object getPreferTypes() {
+        return preferTypes;
+    }
+
+    /**
+     * If set, when parsing resources the parser will try to use the given types when possible, in
+     * the order that they are provided (from highest to lowest priority). For example, if a custom
+     * type which declares to implement the Patient resource is passed in here, and the
+     * parser is parsing a Bundle containing a Patient resource, the parser will use the given
+     * custom type.
+     *
+     * @param preferTypes The preferred types, or <code>null</code>
+     */
+    public void setPreferTypes(Object preferTypes) {
+        this.preferTypes = preferTypes;
+    }
+
+    public Object getForceResourceId() {
+        return forceResourceId;
+    }
+
+    /**
+     * When encoding, force this resource ID to be encoded as the resource ID
+     */
+    public void setForceResourceId(Object forceResourceId) {
+        this.forceResourceId = forceResourceId;
+    }
+
+    public String getServerBaseUrl() {
+        return serverBaseUrl;
+    }
+
+    /**
+     * Sets the server's base URL used by this parser. If a value is set, resource references will be turned into
+     * relative references if they are provided as absolute URLs but have a base matching the given base.
+     *
+     * @param serverBaseUrl The base URL, e.g. "http://example.com/base"
+     */
+    public void setServerBaseUrl(String serverBaseUrl) {
+        this.serverBaseUrl = serverBaseUrl;
+    }
+
+    public Boolean isOmitResourceId() {
+        return omitResourceId;
+    }
+
+    /**
+     * If set to <code>true</code> (default is <code>false</code>) the ID of any resources being encoded will not be
+     * included in the output. Note that this does not apply to contained resources, only to root resources. In other
+     * words, if this is set to <code>true</code>, contained resources will still have local IDs but the outer/containing
+     * ID will not have an ID.
+     *
+     * @param omitResourceId Should resource IDs be omitted
+     */
+    public void setOmitResourceId(Boolean omitResourceId) {
+        this.omitResourceId = omitResourceId;
+    }
+
+    public Set<String> getEncodeElementsAppliesToResourceTypes() {
+        return encodeElementsAppliesToResourceTypes;
+    }
+
+    /**
+     * If provided, tells the parse which resource types to apply {@link #setEncodeElements(Set) encode elements} to. Any
+     * resource types not specified here will be encoded completely, with no elements excluded.
+     *
+     * @param encodeElementsAppliesToResourceTypes resouce types
+     */
+    public void setEncodeElementsAppliesToResourceTypes(Set<String> encodeElementsAppliesToResourceTypes) {
+        this.encodeElementsAppliesToResourceTypes = encodeElementsAppliesToResourceTypes;
+    }
+
+    public Boolean isEncodeElementsAppliesToChildResourcesOnly() {
+        return encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    /**
+     * If set to <code>true</code> (default is false), the values supplied
+     * to {@link #setEncodeElements(Set)} will not be applied to the root
+     * resource (typically a Bundle), but will be applied to any sub-resources
+     * contained within it (i.e. search result resources in that bundle)
+     */
+    public void setEncodeElementsAppliesToChildResourcesOnly(Boolean encodeElementsAppliesToChildResourcesOnly) {
+        this.encodeElementsAppliesToChildResourcesOnly = encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    public Set<String> getEncodeElements() {
+        return encodeElements;
+    }
+
+    /**
+     * If provided, specifies the elements which should be encoded, to the exclusion of all others. Valid values for this
+     * field would include:
+     * <ul>
+     * <li><b>Patient</b> - Encode patient and all its children</li>
+     * <li><b>Patient.name</b> - Encode only the patient's name</li>
+     * <li><b>Patient.name.family</b> - Encode only the patient's family name</li>
+     * <li><b>*.text</b> - Encode the text element on any resource (only the very first position may contain a
+     * wildcard)</li>
+     * <li><b>*.(mandatory)</b> - This is a special case which causes any mandatory fields (min > 0) to be encoded</li>
+     * </ul>
+     *
+     * @param encodeElements The elements to encode
+     * @see #setDontEncodeElements(Set)
+     */
+    public void setEncodeElements(Set<String> encodeElements) {
+        this.encodeElements = encodeElements;
+    }
+
+    public Set<String> getDontEncodeElements() {
+        return dontEncodeElements;
+    }
+
+    /**
+     * If provided, specifies the elements which should NOT be encoded. Valid values for this
+     * field would include:
+     * <ul>
+     * <li><b>Patient</b> - Don't encode patient and all its children</li>
+     * <li><b>Patient.name</b> - Don't encode the patient's name</li>
+     * <li><b>Patient.name.family</b> - Don't encode the patient's family name</li>
+     * <li><b>*.text</b> - Don't encode the text element on any resource (only the very first position may contain a
+     * wildcard)</li>
+     * </ul>
+     * <p>
+     * DSTU2 note: Note that values including meta, such as <code>Patient.meta</code>
+     * will work for DSTU2 parsers, but values with subelements on meta such
+     * as <code>Patient.meta.lastUpdated</code> will only work in
+     * DSTU3+ mode.
+     * </p>
+     *
+     * @param dontEncodeElements The elements to encode
+     * @see #setEncodeElements(Set)
+     */
+    public void setDontEncodeElements(Set<String> dontEncodeElements) {
+        this.dontEncodeElements = dontEncodeElements;
+    }
+
+    public Boolean getStripVersionsFromReferences() {
+        return stripVersionsFromReferences;
+    }
+
+    /**
+     * If set to <code>true<code> (which is the default), resource references containing a version
+     * will have the version removed when the resource is encoded. This is generally good behaviour because
+     * in most situations, references from one resource to another should be to the resource by ID, not
+     * by ID and version. In some cases though, it may be desirable to preserve the version in resource
+     * links. In that case, this value should be set to <code>false</code>.
+     * <p>
+     * This method provides the ability to globally disable reference encoding. If finer-grained
+     * control is needed, use {@link #setDontStripVersionsFromReferencesAtPaths(List)}
+     * </p>
+     *
+     * @param stripVersionsFromReferences Set this to <code>false<code> to prevent the parser from removing resource versions
+     *                                    from references (or <code>null</code> to apply the default setting from the {@link #setParserOptions(Object)}
+     * @see #setDontStripVersionsFromReferencesAtPaths(List)
+     */
+    public void setStripVersionsFromReferences(Boolean stripVersionsFromReferences) {
+        this.stripVersionsFromReferences = stripVersionsFromReferences;
+    }
+
+    public Boolean getOverrideResourceIdWithBundleEntryFullUrl() {
+        return overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    /**
+     * If set to <code>true</code> (which is the default), the Bundle.entry.fullUrl will override the Bundle.entry.resource's
+     * resource id if the fullUrl is defined. This behavior happens when parsing the source data into a Bundle object. Set this
+     * to <code>false</code> if this is not the desired behavior (e.g. the client code wishes to perform additional
+     * validation checks between the fullUrl and the resource id).
+     *
+     * @param overrideResourceIdWithBundleEntryFullUrl
+     *           Set this to <code>false</code> to prevent the parser from overriding resource ids with the
+     *           Bundle.entry.fullUrl (or <code>null</code> to apply the default setting from the {@link #setParserOptions(Object)})
+     */
+    public void setOverrideResourceIdWithBundleEntryFullUrl(Boolean overrideResourceIdWithBundleEntryFullUrl) {
+        this.overrideResourceIdWithBundleEntryFullUrl = overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    public Boolean isSummaryMode() {
+        return summaryMode;
+    }
+
+    /**
+     * If set to <code>true</code> (default is <code>false</code>) only elements marked by the FHIR specification as
+     * being "summary elements" will be included.
+     */
+    public void setSummaryMode(Boolean summaryMode) {
+        this.summaryMode = summaryMode;
+    }
+
+    public Boolean isSuppressNarratives() {
+        return suppressNarratives;
+    }
+
+    /**
+     * If set to <code>true</code> (default is <code>false</code>), narratives will not be included in the encoded
+     * values.
+     */
+    public void setSuppressNarratives(Boolean suppressNarratives) {
+        this.suppressNarratives = suppressNarratives;
+    }
+
+    public List<String> getDontStripVersionsFromReferencesAtPaths() {
+        return dontStripVersionsFromReferencesAtPaths;
+    }
+
+    /**
+     * If supplied value(s), any resource references at the specified paths will have their
+     * resource versions encoded instead of being automatically stripped during the encoding
+     * process. This setting has no effect on the parsing process.
+     * <p>
+     * This method provides a finer-grained level of control than {@link #setStripVersionsFromReferences(Boolean)}
+     * and any paths specified by this method will be encoded even if {@link #setStripVersionsFromReferences(Boolean)}
+     * has been set to <code>true</code> (which is the default)
+     * </p>
+     *
+     * @param dontStripVersionsFromReferencesAtPaths
+     *           A collection of paths for which the resource versions will not be removed automatically
+     *           when serializing, e.g. "Patient.managingOrganization" or "AuditEvent.object.reference". Note that
+     *           only resource name and field names with dots separating is allowed here (no repetition
+     *           indicators, FluentPath expressions, etc.). Set to <code>null</code> to use the value
+     *           set in the {@link #setParserOptions(Object)}
+     * @see #setStripVersionsFromReferences(Boolean)
+     */
+    public void setDontStripVersionsFromReferencesAtPaths(List<String> dontStripVersionsFromReferencesAtPaths) {
+        this.dontStripVersionsFromReferencesAtPaths = dontStripVersionsFromReferencesAtPaths;
+    }
+
+}
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java
index f84e178..d1cd56f 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirJsonDataFormat.java
@@ -18,62 +18,19 @@ package org.apache.camel.model.dataformat;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.Metadata;
 
 /**
  * The FHIR JSon data format is used to marshall/unmarshall to/from FHIR objects to/from JSON.
  */
-@Metadata(firstVersion = "2.21.0", label = "dataformat,transformation,hl7", title = "FHIR JSon")
+@Metadata(firstVersion = "2.21.0", label = "dataformat,transformation,hl7,json", title = "FHIR JSon")
 @XmlRootElement(name = "fhirJson")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class FhirJsonDataFormat extends DataFormatDefinition {
-
-    @XmlTransient @Metadata(label = "advanced")
-    private Object fhirContext;
-
-    @XmlAttribute @Metadata(enums = "DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4", defaultValue = "DSTU3")
-    private String fhirVersion;
+public class FhirJsonDataFormat extends FhirDataformat {
 
     public FhirJsonDataFormat() {
         super("fhirJson");
     }
 
-    public Object getFhirContext() {
-        return fhirContext;
-    }
-
-    public void setFhirContext(Object fhirContext) {
-        this.fhirContext = fhirContext;
-    }
-
-    public String getFhirVersion() {
-        return fhirVersion;
-    }
-
-    /**
-     * The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4
-     */
-    public void setFhirVersion(String fhirVersion) {
-        this.fhirVersion = fhirVersion;
-    }
-
-    @Override
-    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
-        if (getContentTypeHeader() != null) {
-            setProperty(camelContext, dataFormat, "contentTypeHeader", getContentTypeHeader());
-        }
-        if (getFhirContext() != null) {
-            setProperty(camelContext, dataFormat, "fhirContext", getFhirContext());
-        }
-        if (getFhirVersion() != null) {
-            setProperty(camelContext, dataFormat, "fhirVersion", getFhirVersion());
-        }
-    }
 }
diff --git a/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirXmlDataFormat.java b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirXmlDataFormat.java
index bdd4586..b632239 100644
--- a/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirXmlDataFormat.java
+++ b/camel-core/src/main/java/org/apache/camel/model/dataformat/FhirXmlDataFormat.java
@@ -18,64 +18,19 @@ package org.apache.camel.model.dataformat;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
 import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.model.DataFormatDefinition;
-import org.apache.camel.spi.DataFormat;
 import org.apache.camel.spi.Metadata;
 
 /**
  * The FHIR XML data format is used to marshall/unmarshall from/to FHIR objects to/from XML.
  */
-@Metadata(firstVersion = "2.21.0", label = "dataformat,transformation,hl7", title = "FHIR XML")
+@Metadata(firstVersion = "2.21.0", label = "dataformat,transformation,hl7,xml", title = "FHIR XML")
 @XmlRootElement(name = "fhirXml")
 @XmlAccessorType(XmlAccessType.FIELD)
-public class FhirXmlDataFormat extends DataFormatDefinition {
-
-    @XmlTransient
-    @Metadata(label = "advanced")
-    private Object fhirContext;
-
-    @XmlAttribute
-    @Metadata(enums = "DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4", defaultValue = "DSTU3")
-    private String fhirVersion;
+public class FhirXmlDataFormat extends FhirDataformat {
 
     public FhirXmlDataFormat() {
         super("fhirXml");
     }
 
-    public Object getFhirContext() {
-        return fhirContext;
-    }
-
-    public void setFhirContext(Object fhirContext) {
-        this.fhirContext = fhirContext;
-    }
-
-    public String getFhirVersion() {
-        return fhirVersion;
-    }
-
-    /**
-     * The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4
-     */
-    public void setFhirVersion(String fhirVersion) {
-        this.fhirVersion = fhirVersion;
-    }
-
-    @Override
-    protected void configureDataFormat(DataFormat dataFormat, CamelContext camelContext) {
-        if (getContentTypeHeader() != null) {
-            setProperty(camelContext, dataFormat, "contentTypeHeader", getContentTypeHeader());
-        }
-        if (getFhirContext() != null) {
-            setProperty(camelContext, dataFormat, "fhirContext", getFhirContext());
-        }
-        if (getFhirVersion() != null) {
-            setProperty(camelContext, dataFormat, "fhirVersion", getFhirVersion());
-        }
-    }
 }
diff --git a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc
index c69271a..99fbef6 100644
--- a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc
+++ b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirJson-dataformat.adoc
@@ -13,7 +13,7 @@ JSON parser to parse to/from JSON format to/from a HAPI-FHIR's `IBaseResource`.
 ### FHIR JSON Format Options
 
 // dataformat options: START
-The FHIR JSon dataformat supports 2 options, which are listed below.
+The FHIR JSon dataformat supports 14 options, which are listed below.
 
 
 
@@ -21,6 +21,18 @@ The FHIR JSon dataformat supports 2 options, which are listed below.
 |===
 | Name | Default | Java Type | Description
 | fhirVersion | DSTU3 | String | The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4
+| prettyPrint | false | Boolean | Sets the pretty print flag, meaning that the parser will encode resources with human-readable spacing and newlines between elements instead of condensing output as much as possible.
+| serverBaseUrl |  | String | Sets the server's base URL used by this parser. If a value is set, resource references will be turned into relative references if they are provided as absolute URLs but have a base matching the given base.
+| omitResourceId | false | Boolean | If set to true (default is false) the ID of any resources being encoded will not be included in the output. Note that this does not apply to contained resources, only to root resources. In other words, if this is set to true, contained resources will still have local IDs but the outer/containing ID will not have an ID.
+| encodeElementsAppliesToResourceTypes |  | Set | If provided, tells the parse which resource types to apply link setEncodeElements(Set) encode elements to. Any resource types not specified here will be encoded completely, with no elements excluded.
+| encodeElementsAppliesToChildResourcesOnly | false | Boolean | If set to true (default is false), the values supplied to link setEncodeElements(Set) will not be applied to the root resource (typically a Bundle), but will be applied to any sub-resources contained within it (i.e. search result resources in that bundle)
+| encodeElements |  | Set | If provided, specifies the elements which should be encoded, to the exclusion of all others. Valid values for this field would include: Patient - Encode patient and all its children Patient.name - Encode only the patient's name Patient.name.family - Encode only the patient's family name .text - Encode the text element on any resource (only the very first position may contain a wildcard) .(mandatory) - This is a special case which causes any mandatory fields (m [...]
+| dontEncodeElements |  | Set | If provided, specifies the elements which should NOT be encoded. Valid values for this field would include: Patient - Don't encode patient and all its children Patient.name - Don't encode the patient's name Patient.name.family - Don't encode the patient's family name .text - Don't encode the text element on any resource (only the very first position may contain a wildcard) DSTU2 note: Note that values including meta, such as Patient.meta will work for DSTU [...]
+| stripVersionsFromReferences | false | Boolean | If set to true (which is the default), resource references containing a version will have the version removed when the resource is encoded. This is generally good behaviour because in most situations, references from one resource to another should be to the resource by ID, not by ID and version. In some cases though, it may be desirable to preserve the version in resource links. In that case, this value should be set to false. This method [...]
+| overrideResourceIdWithBundleEntryFullUrl | false | Boolean | If set to true (which is the default), the Bundle.entry.fullUrl will override the Bundle.entry.resource's resource id if the fullUrl is defined. This behavior happens when parsing the source data into a Bundle object. Set this to false if this is not the desired behavior (e.g. the client code wishes to perform additional validation checks between the fullUrl and the resource id).
+| summaryMode | false | Boolean | If set to true (default is false) only elements marked by the FHIR specification as being summary elements will be included.
+| suppressNarratives | false | Boolean | If set to true (default is false), narratives will not be included in the encoded values.
+| dontStripVersionsFromReferencesAtPaths |  | List | If supplied value(s), any resource references at the specified paths will have their resource versions encoded instead of being automatically stripped during the encoding process. This setting has no effect on the parsing process. This method provides a finer-grained level of control than link setStripVersionsFromReferences(Boolean) and any paths specified by this method will be encoded even if link setStripVersionsFromReferences(Boole [...]
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc
index c2ae8e9..cc78341 100644
--- a/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc
+++ b/components/camel-fhir/camel-fhir-component/src/main/docs/fhirXml-dataformat.adoc
@@ -12,7 +12,7 @@ XML parser to parse to/from XML format to/from a HAPI-FHIR's `IBaseResource`.
 ### FHIR XML Format Options
 
 // dataformat options: START
-The FHIR XML dataformat supports 2 options, which are listed below.
+The FHIR XML dataformat supports 14 options, which are listed below.
 
 
 
@@ -20,6 +20,18 @@ The FHIR XML dataformat supports 2 options, which are listed below.
 |===
 | Name | Default | Java Type | Description
 | fhirVersion | DSTU3 | String | The version of FHIR to use. Possible values are: DSTU2,DSTU2_HL7ORG,DSTU2_1,DSTU3,R4
+| prettyPrint | false | Boolean | Sets the pretty print flag, meaning that the parser will encode resources with human-readable spacing and newlines between elements instead of condensing output as much as possible.
+| serverBaseUrl |  | String | Sets the server's base URL used by this parser. If a value is set, resource references will be turned into relative references if they are provided as absolute URLs but have a base matching the given base.
+| omitResourceId | false | Boolean | If set to true (default is false) the ID of any resources being encoded will not be included in the output. Note that this does not apply to contained resources, only to root resources. In other words, if this is set to true, contained resources will still have local IDs but the outer/containing ID will not have an ID.
+| encodeElementsAppliesToResourceTypes |  | Set | If provided, tells the parse which resource types to apply link setEncodeElements(Set) encode elements to. Any resource types not specified here will be encoded completely, with no elements excluded.
+| encodeElementsAppliesToChildResourcesOnly | false | Boolean | If set to true (default is false), the values supplied to link setEncodeElements(Set) will not be applied to the root resource (typically a Bundle), but will be applied to any sub-resources contained within it (i.e. search result resources in that bundle)
+| encodeElements |  | Set | If provided, specifies the elements which should be encoded, to the exclusion of all others. Valid values for this field would include: Patient - Encode patient and all its children Patient.name - Encode only the patient's name Patient.name.family - Encode only the patient's family name .text - Encode the text element on any resource (only the very first position may contain a wildcard) .(mandatory) - This is a special case which causes any mandatory fields (m [...]
+| dontEncodeElements |  | Set | If provided, specifies the elements which should NOT be encoded. Valid values for this field would include: Patient - Don't encode patient and all its children Patient.name - Don't encode the patient's name Patient.name.family - Don't encode the patient's family name .text - Don't encode the text element on any resource (only the very first position may contain a wildcard) DSTU2 note: Note that values including meta, such as Patient.meta will work for DSTU [...]
+| stripVersionsFromReferences | false | Boolean | If set to true (which is the default), resource references containing a version will have the version removed when the resource is encoded. This is generally good behaviour because in most situations, references from one resource to another should be to the resource by ID, not by ID and version. In some cases though, it may be desirable to preserve the version in resource links. In that case, this value should be set to false. This method [...]
+| overrideResourceIdWithBundleEntryFullUrl | false | Boolean | If set to true (which is the default), the Bundle.entry.fullUrl will override the Bundle.entry.resource's resource id if the fullUrl is defined. This behavior happens when parsing the source data into a Bundle object. Set this to false if this is not the desired behavior (e.g. the client code wishes to perform additional validation checks between the fullUrl and the resource id).
+| summaryMode | false | Boolean | If set to true (default is false) only elements marked by the FHIR specification as being summary elements will be included.
+| suppressNarratives | false | Boolean | If set to true (default is false), narratives will not be included in the encoded values.
+| dontStripVersionsFromReferencesAtPaths |  | List | If supplied value(s), any resource references at the specified paths will have their resource versions encoded instead of being automatically stripped during the encoding process. This setting has no effect on the parsing process. This method provides a finer-grained level of control than link setStripVersionsFromReferences(Boolean) and any paths specified by this method will be encoded even if link setStripVersionsFromReferences(Boole [...]
 | contentTypeHeader | false | Boolean | Whether the data format should set the Content-Type header with the type from the data format if the data format is capable of doing so. For example application/xml for data formats marshalling to XML, or application/json for data formats marshalling to JSon etc.
 |===
 // dataformat options: END
diff --git a/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirDataFormat.java b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirDataFormat.java
new file mode 100644
index 0000000..1ea4fb4
--- /dev/null
+++ b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirDataFormat.java
@@ -0,0 +1,262 @@
+/**
+ * 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.component.fhir;
+
+import java.util.List;
+import java.util.Set;
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.context.FhirVersionEnum;
+import ca.uhn.fhir.context.ParserOptions;
+import ca.uhn.fhir.parser.IParser;
+import ca.uhn.fhir.parser.IParserErrorHandler;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.spi.DataFormatName;
+import org.apache.camel.support.ServiceSupport;
+import org.apache.camel.util.ObjectHelper;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IIdType;
+
+public abstract class FhirDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
+
+    private FhirContext fhirContext;
+    private String fhirVersion;
+    private boolean contentTypeHeader = true;
+    private IParserErrorHandler parserErrorHandler;
+    private ParserOptions parserOptions;
+    private String serverBaseUrl;
+    private boolean prettyPrint;
+    private List<Class<? extends IBaseResource>> preferTypes;
+    private boolean omitResourceId;
+    private IIdType forceResourceId;
+    private Set<String> encodeElementsAppliesToResourceTypes;
+    private boolean encodeElementsAppliesToChildResourcesOnly;
+    private Set<String> encodeElements;
+    private Set<String> dontEncodeElements;
+    private Boolean stripVersionsFromReferences;
+    private Boolean overrideResourceIdWithBundleEntryFullUrl;
+    private boolean summaryMode;
+    private boolean suppressNarratives;
+    private List<String> dontStripVersionsFromReferencesAtPaths;
+
+    public FhirContext getFhirContext() {
+        return fhirContext;
+    }
+
+    public void setFhirContext(FhirContext fhirContext) {
+        this.fhirContext = fhirContext;
+    }
+
+    public String getFhirVersion() {
+        return fhirVersion;
+    }
+
+    public void setFhirVersion(String fhirVersion) {
+        this.fhirVersion = fhirVersion;
+    }
+
+    public boolean isContentTypeHeader() {
+        return contentTypeHeader;
+    }
+
+    public void setContentTypeHeader(boolean contentTypeHeader) {
+        this.contentTypeHeader = contentTypeHeader;
+    }
+
+    public IParserErrorHandler getParserErrorHandler() {
+        return parserErrorHandler;
+    }
+
+    public void setParserErrorHandler(IParserErrorHandler parserErrorHandler) {
+        this.parserErrorHandler = parserErrorHandler;
+    }
+
+    public ParserOptions getParserOptions() {
+        return parserOptions;
+    }
+
+    public void setParserOptions(ParserOptions parserOptions) {
+        this.parserOptions = parserOptions;
+    }
+
+    public String getServerBaseUrl() {
+        return serverBaseUrl;
+    }
+
+    public void setServerBaseUrl(String serverBaseUrl) {
+        this.serverBaseUrl = serverBaseUrl;
+    }
+
+    public boolean isPrettyPrint() {
+        return prettyPrint;
+    }
+
+    public void setPrettyPrint(boolean prettyPrint) {
+        this.prettyPrint = prettyPrint;
+    }
+
+    public List<Class<? extends IBaseResource>> getPreferTypes() {
+        return preferTypes;
+    }
+
+    public void setPreferTypes(List<Class<? extends IBaseResource>> preferTypes) {
+        this.preferTypes = preferTypes;
+    }
+
+    public boolean isOmitResourceId() {
+        return omitResourceId;
+    }
+
+    public void setOmitResourceId(boolean omitResourceId) {
+        this.omitResourceId = omitResourceId;
+    }
+
+    public IIdType getForceResourceId() {
+        return forceResourceId;
+    }
+
+    public void setForceResourceId(IIdType forceResourceId) {
+        this.forceResourceId = forceResourceId;
+    }
+
+    public Set<String> getEncodeElementsAppliesToResourceTypes() {
+        return encodeElementsAppliesToResourceTypes;
+    }
+
+    public void setEncodeElementsAppliesToResourceTypes(Set<String> encodeElementsAppliesToResourceTypes) {
+        this.encodeElementsAppliesToResourceTypes = encodeElementsAppliesToResourceTypes;
+    }
+
+    public boolean isEncodeElementsAppliesToChildResourcesOnly() {
+        return encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    public void setEncodeElementsAppliesToChildResourcesOnly(boolean encodeElementsAppliesToChildResourcesOnly) {
+        this.encodeElementsAppliesToChildResourcesOnly = encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    public Set<String> getEncodeElements() {
+        return encodeElements;
+    }
+
+    public void setEncodeElements(Set<String> encodeElements) {
+        this.encodeElements = encodeElements;
+    }
+
+    public Set<String> getDontEncodeElements() {
+        return dontEncodeElements;
+    }
+
+    public void setDontEncodeElements(Set<String> dontEncodeElements) {
+        this.dontEncodeElements = dontEncodeElements;
+    }
+
+    public Boolean getStripVersionsFromReferences() {
+        return stripVersionsFromReferences;
+    }
+
+    public void setStripVersionsFromReferences(Boolean stripVersionsFromReferences) {
+        this.stripVersionsFromReferences = stripVersionsFromReferences;
+    }
+
+    public Boolean getOverrideResourceIdWithBundleEntryFullUrl() {
+        return overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    public void setOverrideResourceIdWithBundleEntryFullUrl(Boolean overrideResourceIdWithBundleEntryFullUrl) {
+        this.overrideResourceIdWithBundleEntryFullUrl = overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    public boolean isSummaryMode() {
+        return summaryMode;
+    }
+
+    public void setSummaryMode(boolean summaryMode) {
+        this.summaryMode = summaryMode;
+    }
+
+    public boolean isSuppressNarratives() {
+        return suppressNarratives;
+    }
+
+    public void setSuppressNarratives(boolean suppressNarratives) {
+        this.suppressNarratives = suppressNarratives;
+    }
+
+    public List<String> getDontStripVersionsFromReferencesAtPaths() {
+        return dontStripVersionsFromReferencesAtPaths;
+    }
+
+    public void setDontStripVersionsFromReferencesAtPaths(List<String> dontStripVersionsFromReferencesAtPaths) {
+        this.dontStripVersionsFromReferencesAtPaths = dontStripVersionsFromReferencesAtPaths;
+    }
+
+    protected void configureParser(IParser parser) {
+        if (ObjectHelper.isNotEmpty(getServerBaseUrl())) {
+            parser.setServerBaseUrl(getServerBaseUrl());
+        }
+        if (ObjectHelper.isNotEmpty(getDontEncodeElements())) {
+            parser.setDontEncodeElements(getDontEncodeElements());
+        }
+        if (ObjectHelper.isNotEmpty(getDontStripVersionsFromReferencesAtPaths())) {
+            parser.setDontStripVersionsFromReferencesAtPaths(getDontStripVersionsFromReferencesAtPaths());
+        }
+        if (ObjectHelper.isNotEmpty(getEncodeElements())) {
+            parser.setEncodeElements(getEncodeElements());
+        }
+        if (ObjectHelper.isNotEmpty(getEncodeElementsAppliesToResourceTypes())) {
+            parser.setEncodeElementsAppliesToResourceTypes(getEncodeElementsAppliesToResourceTypes());
+        }
+        if (ObjectHelper.isNotEmpty(getForceResourceId())) {
+            parser.setEncodeForceResourceId(getForceResourceId());
+        }
+        if (ObjectHelper.isNotEmpty(getPreferTypes())) {
+            parser.setPreferTypes(getPreferTypes());
+        }
+        if (ObjectHelper.isNotEmpty(getParserErrorHandler())) {
+            parser.setParserErrorHandler(getParserErrorHandler());
+        }
+        if (ObjectHelper.isNotEmpty(getOverrideResourceIdWithBundleEntryFullUrl())) {
+            parser.setOverrideResourceIdWithBundleEntryFullUrl(getOverrideResourceIdWithBundleEntryFullUrl());
+        }
+        if (ObjectHelper.isNotEmpty(getStripVersionsFromReferences())) {
+            parser.setStripVersionsFromReferences(getStripVersionsFromReferences());
+        }
+        parser.setSummaryMode(isSummaryMode());
+        parser.setOmitResourceId(isOmitResourceId());
+        parser.setPrettyPrint(isPrettyPrint());
+        parser.setEncodeElementsAppliesToChildResourcesOnly(isEncodeElementsAppliesToChildResourcesOnly());
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        if (fhirContext == null && fhirVersion != null) {
+            FhirVersionEnum version = FhirVersionEnum.valueOf(fhirVersion);
+            fhirContext = new FhirContext(version);
+        } else if (fhirContext == null) {
+            fhirContext = FhirContext.forDstu3();
+        }
+        if (ObjectHelper.isNotEmpty(parserOptions)) {
+            fhirContext.setParserOptions(parserOptions);
+        }
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        // noop
+    }
+
+}
diff --git a/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirJsonDataFormat.java b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirJsonDataFormat.java
index 05fbfc7..d384b54 100644
--- a/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirJsonDataFormat.java
+++ b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirJsonDataFormat.java
@@ -20,44 +20,11 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
+import ca.uhn.fhir.parser.IParser;
 import org.apache.camel.Exchange;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.DataFormatName;
-import org.apache.camel.support.ServiceSupport;
 import org.hl7.fhir.instance.model.api.IBaseResource;
 
-public class FhirJsonDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
-
-    private FhirContext fhirContext;
-    private String fhirVersion;
-    private boolean contentTypeHeader = true;
-
-    public FhirContext getFhirContext() {
-        return fhirContext;
-    }
-
-    public void setFhirContext(FhirContext fhirContext) {
-        this.fhirContext = fhirContext;
-    }
-
-    public String getFhirVersion() {
-        return fhirVersion;
-    }
-
-    public void setFhirVersion(String fhirVersion) {
-        this.fhirVersion = fhirVersion;
-    }
-
-    public boolean isContentTypeHeader() {
-        return contentTypeHeader;
-    }
-
-    public void setContentTypeHeader(boolean contentTypeHeader) {
-        this.contentTypeHeader = contentTypeHeader;
-    }
+public class FhirJsonDataFormat extends FhirDataFormat {
 
     @Override
     public void marshal(Exchange exchange, Object o, OutputStream outputStream) throws Exception {
@@ -68,35 +35,24 @@ public class FhirJsonDataFormat extends ServiceSupport implements DataFormat, Da
             iBaseResource = (IBaseResource) o;
         }
 
-        fhirContext.newJsonParser().encodeResourceToWriter(iBaseResource, new OutputStreamWriter(outputStream));
+        IParser parser = getFhirContext().newJsonParser();
+        configureParser(parser);
+        parser.encodeResourceToWriter(iBaseResource, new OutputStreamWriter(outputStream));
 
         if (isContentTypeHeader()) {
-            exchange.getMessage().setHeader(Exchange.CONTENT_TYPE, "application/json");
+            exchange.getMessage().setHeader(Exchange.CONTENT_TYPE, parser.getEncoding().getResourceContentTypeNonLegacy());
         }
     }
 
     @Override
     public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
-        return fhirContext.newJsonParser().parseResource(new InputStreamReader(inputStream));
+        IParser parser = getFhirContext().newJsonParser();
+        configureParser(parser);
+        return parser.parseResource(new InputStreamReader(inputStream));
     }
 
     @Override
     public String getDataFormatName() {
         return "fhirJson";
     }
-
-    @Override
-    protected void doStart() throws Exception {
-        if (fhirContext == null && fhirVersion != null) {
-            FhirVersionEnum version = FhirVersionEnum.valueOf(fhirVersion);
-            fhirContext = new FhirContext(version);
-        } else if (fhirContext == null) {
-            fhirContext = FhirContext.forDstu3();
-        }
-    }
-
-    @Override
-    protected void doStop() throws Exception {
-        // noop
-    }
 }
diff --git a/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirXmlDataFormat.java b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirXmlDataFormat.java
index 42c13dd..844ff96 100644
--- a/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirXmlDataFormat.java
+++ b/components/camel-fhir/camel-fhir-component/src/main/java/org/apache/camel/component/fhir/FhirXmlDataFormat.java
@@ -20,44 +20,12 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
+import ca.uhn.fhir.parser.IParser;
 import org.apache.camel.Exchange;
-import org.apache.camel.spi.DataFormat;
-import org.apache.camel.spi.DataFormatName;
-import org.apache.camel.support.ServiceSupport;
 import org.hl7.fhir.instance.model.api.IBaseResource;
 
-public class FhirXmlDataFormat extends ServiceSupport implements DataFormat, DataFormatName {
+public class FhirXmlDataFormat extends FhirDataFormat {
     
-    private FhirContext fhirContext;
-    private String fhirVersion;
-    private boolean contentTypeHeader = true;
-
-    public FhirContext getFhirContext() {
-        return fhirContext;
-    }
-
-    public void setFhirContext(FhirContext fhirContext) {
-        this.fhirContext = fhirContext;
-    }
-
-    public String getFhirVersion() {
-        return fhirVersion;
-    }
-
-    public void setFhirVersion(String fhirVersion) {
-        this.fhirVersion = fhirVersion;
-    }
-
-    public boolean isContentTypeHeader() {
-        return contentTypeHeader;
-    }
-
-    public void setContentTypeHeader(boolean contentTypeHeader) {
-        this.contentTypeHeader = contentTypeHeader;
-    }
 
     @Override
     public void marshal(Exchange exchange, Object o, OutputStream outputStream) throws Exception {
@@ -68,35 +36,23 @@ public class FhirXmlDataFormat extends ServiceSupport implements DataFormat, Dat
             iBaseResource = (IBaseResource) o;
         }
 
-        fhirContext.newXmlParser().encodeResourceToWriter(iBaseResource, new OutputStreamWriter(outputStream));
-
+        IParser parser = getFhirContext().newXmlParser();
+        configureParser(parser);
+        parser.encodeResourceToWriter(iBaseResource, new OutputStreamWriter(outputStream));
         if (isContentTypeHeader()) {
-            exchange.getMessage().setHeader(Exchange.CONTENT_TYPE, "application/json");
+            exchange.getMessage().setHeader(Exchange.CONTENT_TYPE, parser.getEncoding().getResourceContentTypeNonLegacy());
         }
     }
 
     @Override
     public Object unmarshal(Exchange exchange, InputStream inputStream) throws Exception {
-        return fhirContext.newXmlParser().parseResource(new InputStreamReader(inputStream));
+        IParser parser = getFhirContext().newXmlParser();
+        configureParser(parser);
+        return parser.parseResource(new InputStreamReader(inputStream));
     }
 
     @Override
     public String getDataFormatName() {
         return "fhirXml";
     }
-
-    @Override
-    protected void doStart() throws Exception {
-        if (fhirContext == null && fhirVersion != null) {
-            FhirVersionEnum version = FhirVersionEnum.valueOf(fhirVersion);
-            fhirContext = new FhirContext(version);
-        } else if (fhirContext == null) {
-            fhirContext = FhirContext.forDstu3();
-        }
-    }
-
-    @Override
-    protected void doStop() throws Exception {
-        // noop
-    }
 }
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
similarity index 98%
rename from components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java
rename to components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
index e2ca74d..6394c38 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.fhir;
+package org.apache.camel.component.fhir.dataformat;
 
 import java.io.InputStream;
 import java.io.InputStreamReader;
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
new file mode 100644
index 0000000..fa7bf22
--- /dev/null
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
@@ -0,0 +1,104 @@
+/**
+ * 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.component.fhir.dataformat;
+
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.parser.DataFormatException;
+import ca.uhn.fhir.parser.IParserErrorHandler;
+import ca.uhn.fhir.parser.LenientErrorHandler;
+import ca.uhn.fhir.parser.StrictErrorHandler;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.fhir.FhirJsonDataFormat;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.hl7.fhir.dstu3.model.Patient;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FhirJsonDataformatErrorHandlerTest extends CamelTestSupport {
+
+    private static final String INPUT = "{\"resourceType\":\"Patient\",\"extension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]}";
+
+    private MockEndpoint mockEndpoint;
+    private final FhirContext fhirContext = FhirContext.forDstu3();
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+    }
+
+    @Test(expected = DataFormatException.class)
+    public void unmarshalParserErrorHandler() throws Throwable {
+        try {
+            template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+        } catch (CamelExecutionException e) {
+            throw e.getCause();
+        }
+    }
+
+    @Test
+    public void unmarshalLenientErrorHandler() throws Exception {
+        mockEndpoint.expectedMessageCount(1);
+
+        template.sendBody("direct:unmarshalErrorHandlerLenient", INPUT);
+
+        mockEndpoint.assertIsSatisfied();
+
+        Exchange exchange = mockEndpoint.getExchanges().get(0);
+        Patient patient = (Patient) exchange.getIn().getBody();
+        assertEquals(1, patient.getExtension().size());
+        assertEquals(null, patient.getExtension().get(0).getUrl());
+        assertEquals("2011-01-02T11:13:15", patient.getExtension().get(0).getValueAsPrimitive().getValueAsString());    }
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                FhirJsonDataFormat strickErrorHandlerDataformat = getStrictErrorHandlerDataFormat();
+                FhirJsonDataFormat lenientErrorHandlerDataFormat = getLenientErrorHandlerDataFormat();
+
+                from("direct:unmarshalErrorHandlerStrict")
+                        .unmarshal(strickErrorHandlerDataformat)
+                        .to("mock:errorIsThrown");
+
+                from("direct:unmarshalErrorHandlerLenient")
+                        .unmarshal(lenientErrorHandlerDataFormat)
+                        .to("mock:result");
+            }
+
+            private FhirJsonDataFormat getStrictErrorHandlerDataFormat() {
+                FhirJsonDataFormat fhirJsonDataFormat = new FhirJsonDataFormat();
+                fhirJsonDataFormat.setFhirContext(fhirContext);
+                IParserErrorHandler parserErrorHandler = new StrictErrorHandler();
+                fhirJsonDataFormat.setParserErrorHandler(parserErrorHandler);
+                return fhirJsonDataFormat;
+            }
+
+            private FhirJsonDataFormat getLenientErrorHandlerDataFormat() {
+                FhirJsonDataFormat fhirJsonDataFormat = new FhirJsonDataFormat();
+                fhirJsonDataFormat.setFhirContext(fhirContext);
+                IParserErrorHandler parserErrorHandler = new LenientErrorHandler();
+                fhirJsonDataFormat.setParserErrorHandler(parserErrorHandler);
+                return fhirJsonDataFormat;
+            }
+
+        };
+    }
+}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
similarity index 98%
rename from components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java
rename to components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
index 7b3e364..fe7e024 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.fhir;
+package org.apache.camel.component.fhir.dataformat;
 
 import java.io.InputStream;
 import java.io.InputStreamReader;
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
new file mode 100644
index 0000000..0ea3e8b
--- /dev/null
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
@@ -0,0 +1,103 @@
+/**
+ * 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.component.fhir.dataformat;
+
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.parser.DataFormatException;
+import ca.uhn.fhir.parser.IParserErrorHandler;
+import ca.uhn.fhir.parser.LenientErrorHandler;
+import ca.uhn.fhir.parser.StrictErrorHandler;
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.fhir.FhirXmlDataFormat;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.hl7.fhir.dstu3.model.Patient;
+import org.junit.Before;
+import org.junit.Test;
+
+public class FhirXmlDataformatErrorHandlerTest extends CamelTestSupport {
+
+    private static final String INPUT = "<Patient><active value=\"true\"/><active value=\"false\"/></Patient>";
+
+    private MockEndpoint mockEndpoint;
+    private final FhirContext fhirContext = FhirContext.forDstu3();
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
+    }
+
+    @Test(expected = DataFormatException.class)
+    public void unmarshalParserErrorHandler() throws Throwable {
+        try {
+            template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+        } catch (CamelExecutionException e) {
+            throw e.getCause();
+        }
+    }
+
+    @Test
+    public void unmarshalLenientErrorHandler() throws Exception {
+        mockEndpoint.expectedMessageCount(1);
+
+        template.sendBody("direct:unmarshalErrorHandlerLenient", INPUT);
+
+        mockEndpoint.assertIsSatisfied();
+
+        Exchange exchange = mockEndpoint.getExchanges().get(0);
+        Patient patient = (Patient) exchange.getIn().getBody();
+        assertEquals(true, patient.getActive());
+    }
+
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            public void configure() {
+                FhirXmlDataFormat strickErrorHandlerDataformat = getStrictErrorHandlerDataFormat();
+                FhirXmlDataFormat lenientErrorHandlerDataFormat = getLenientErrorHandlerDataFormat();
+
+                from("direct:unmarshalErrorHandlerStrict")
+                        .unmarshal(strickErrorHandlerDataformat)
+                        .to("mock:errorIsThrown");
+
+                from("direct:unmarshalErrorHandlerLenient")
+                        .unmarshal(lenientErrorHandlerDataFormat)
+                        .to("mock:result");
+            }
+
+            private FhirXmlDataFormat getStrictErrorHandlerDataFormat() {
+                FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat();
+                fhirXmlDataFormat.setFhirContext(fhirContext);
+                IParserErrorHandler parserErrorHandler = new StrictErrorHandler();
+                fhirXmlDataFormat.setParserErrorHandler(parserErrorHandler);
+                return fhirXmlDataFormat;
+            }
+
+            private FhirXmlDataFormat getLenientErrorHandlerDataFormat() {
+                FhirXmlDataFormat fhirXmlDataFormat = new FhirXmlDataFormat();
+                fhirXmlDataFormat.setFhirContext(fhirContext);
+                IParserErrorHandler parserErrorHandler = new LenientErrorHandler();
+                fhirXmlDataFormat.setParserErrorHandler(parserErrorHandler);
+                return fhirXmlDataFormat;
+            }
+
+        };
+    }
+}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatConfigSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatConfigSpringTest.java
new file mode 100644
index 0000000..a908cb5
--- /dev/null
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatConfigSpringTest.java
@@ -0,0 +1,98 @@
+/**
+ * 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.component.fhir.dataformat.spring;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import ca.uhn.fhir.context.FhirVersionEnum;
+import ca.uhn.fhir.context.ParserOptions;
+import ca.uhn.fhir.parser.LenientErrorHandler;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.fhir.FhirDataFormat;
+import org.apache.camel.model.dataformat.FhirDataformat;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.hl7.fhir.dstu3.model.IdType;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class FhirDataformatConfigSpringTest extends CamelSpringTestSupport {
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Test
+    public void defaultFhirJsonConfigTest() {
+        FhirDataFormat fhirJson = getDataformat("fhirJson");
+        assertConfig(fhirJson);
+    }
+
+    @Test
+    public void defaultFhirXmlConfigTest() {
+        FhirDataFormat fhirXml = getDataformat("fhirXml");
+        assertConfig(fhirXml);
+    }
+
+    private void assertConfig(FhirDataFormat fhirJson) {
+        assertEquals(FhirVersionEnum.DSTU3, fhirJson.getFhirContext().getVersion().getVersion());
+        Set<String> dontEncodeElements = fhirJson.getDontEncodeElements();
+        assertCollection(dontEncodeElements);
+        List<String> dontStripVersionsFromReferencesAtPaths = fhirJson.getDontStripVersionsFromReferencesAtPaths();
+        assertCollection(dontStripVersionsFromReferencesAtPaths);
+        Set<String> encodeElements = fhirJson.getEncodeElements();
+        assertCollection(encodeElements);
+        Set<String> encodeElementsAppliesToResourceTypes = fhirJson.getEncodeElementsAppliesToResourceTypes();
+        assertCollection(encodeElementsAppliesToResourceTypes);
+        assertTrue(fhirJson.getForceResourceId().getClass().isAssignableFrom(IdType.class));
+        assertTrue(fhirJson.getParserErrorHandler().getClass().isAssignableFrom(LenientErrorHandler.class));
+        assertTrue(fhirJson.getParserOptions().getClass().isAssignableFrom(ParserOptions.class));
+        assertNotNull(fhirJson.getPreferTypes());
+        assertEquals("serverBaseUrl", fhirJson.getServerBaseUrl());
+        assertTrue(fhirJson.getOverrideResourceIdWithBundleEntryFullUrl());
+        assertTrue(fhirJson.getStripVersionsFromReferences());
+        assertTrue(fhirJson.isPrettyPrint());
+        assertTrue(fhirJson.isEncodeElementsAppliesToChildResourcesOnly());
+        assertTrue(fhirJson.isOmitResourceId());
+        assertTrue(fhirJson.isSummaryMode());
+        assertTrue(fhirJson.isSuppressNarratives());
+    }
+
+    private void assertCollection(Collection<String> encodeElements) {
+        assertEquals(2, encodeElements.size());
+        assertTrue(encodeElements.contains("foo"));
+        assertTrue(encodeElements.contains("bar"));
+    }
+
+    private FhirDataFormat getDataformat(String name) {
+        CamelContext camelContext = context();
+        return (FhirDataFormat) ((FhirDataformat) camelContext.getRegistry().lookupByName(name)).getDataFormat();
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/FhirDataFormatConfigSpringTest.xml");
+    }
+}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatDefaultConfigSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatDefaultConfigSpringTest.java
new file mode 100644
index 0000000..c3ae98f
--- /dev/null
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatDefaultConfigSpringTest.java
@@ -0,0 +1,82 @@
+/**
+ * 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.component.fhir.dataformat.spring;
+
+import ca.uhn.fhir.context.FhirVersionEnum;
+import org.apache.camel.CamelContext;
+import org.apache.camel.component.fhir.FhirDataFormat;
+import org.apache.camel.model.dataformat.FhirDataformat;
+import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+
+public class FhirDataformatDefaultConfigSpringTest extends CamelSpringTestSupport {
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+
+    @Test
+    public void defaultFhirJsonConfigTest() {
+        FhirDataFormat fhirJson = getDataformat("fhirJson");
+        assertDefaultConfig(fhirJson);
+    }
+
+    @Test
+    public void defaultFhirXmlConfigTest() {
+        FhirDataFormat fhirXml = getDataformat("fhirXml");
+        assertDefaultConfig(fhirXml);
+    }
+
+    private void assertDefaultConfig(FhirDataFormat fhirJson) {
+        assertEquals(FhirVersionEnum.DSTU3, fhirJson.getFhirContext().getVersion().getVersion());
+        assertNull(fhirJson.getDontEncodeElements());
+        assertNull(fhirJson.getDontStripVersionsFromReferencesAtPaths());
+        assertNull(fhirJson.getEncodeElements());
+        assertNull(fhirJson.getEncodeElementsAppliesToResourceTypes());
+        assertNull(fhirJson.getForceResourceId());
+        assertNull(fhirJson.getParserErrorHandler());
+        assertNull(fhirJson.getParserOptions());
+        assertNull(fhirJson.getPreferTypes());
+        assertNull(fhirJson.getServerBaseUrl());
+        assertNull(fhirJson.getOverrideResourceIdWithBundleEntryFullUrl());
+        assertNull(fhirJson.getStripVersionsFromReferences());
+        assertFalse(fhirJson.isPrettyPrint());
+        assertFalse(fhirJson.isEncodeElementsAppliesToChildResourcesOnly());
+        assertFalse(fhirJson.isOmitResourceId());
+        assertFalse(fhirJson.isSummaryMode());
+        assertFalse(fhirJson.isSuppressNarratives());
+    }
+
+    private FhirDataFormat getDataformat(String name) {
+        CamelContext camelContext = context();
+        return (FhirDataFormat) ((FhirDataformat) camelContext.getDataFormats().get(name)).getDataFormat();
+    }
+
+    @Override
+    protected AbstractApplicationContext createApplicationContext() {
+        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/FhirDataFormatDefaultConfigSpringTest.xml");
+    }
+}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataFormatSpringTest.java
similarity index 98%
copy from components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java
copy to components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataFormatSpringTest.java
index e2a43f9..6a0509b 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataFormatSpringTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.fhir;
+package org.apache.camel.component.fhir.dataformat.spring;
 
 import java.io.InputStream;
 import java.io.InputStreamReader;
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataformatErrorHandlerSpringTest.java
similarity index 50%
copy from components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java
copy to components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataformatErrorHandlerSpringTest.java
index e2a43f9..ce78618 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataformatErrorHandlerSpringTest.java
@@ -14,30 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.fhir;
+package org.apache.camel.component.fhir.dataformat.spring;
 
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.parser.DataFormatException;
+import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.hl7.fhir.dstu3.model.Address;
-import org.hl7.fhir.dstu3.model.Base;
-import org.hl7.fhir.dstu3.model.HumanName;
 import org.hl7.fhir.dstu3.model.Patient;
-import org.hl7.fhir.instance.model.api.IBaseResource;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
-
-    private static final String PATIENT = "{\"resourceType\":\"Patient\","
-            + "\"name\":[{\"family\":\"Holmes\",\"given\":[\"Sherlock\"]}],"
-            + "\"address\":[{\"line\":[\"221b Baker St, Marylebone, London NW1 6XE, UK\"]}]}";
+public class FhirJsonDataformatErrorHandlerSpringTest extends CamelSpringTestSupport {
 
+    private static final String INPUT = "{\"resourceType\":\"Patient\",\"extension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]}";
     private MockEndpoint mockEndpoint;
 
     @Override
@@ -47,42 +39,32 @@ public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
         mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
     }
 
-    @Test
-    public void unmarshal() throws Exception {
-        mockEndpoint.expectedMessageCount(1);
-
-        template.sendBody("direct:unmarshal", PATIENT);
-
-        mockEndpoint.assertIsSatisfied();
-
-        Exchange exchange = mockEndpoint.getExchanges().get(0);
-        Patient patient = (Patient) exchange.getIn().getBody();
-        assertTrue("Patients should be equal!", patient.equalsDeep(getPatient()));
+    @Test(expected = DataFormatException.class)
+    public void unmarshalParserErrorHandler() throws Throwable {
+        try {
+            template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+        } catch (CamelExecutionException e) {
+            throw e.getCause();
+        }
     }
 
     @Test
-    public void marshal() throws Exception {
+    public void unmarshalLenientErrorHandler() throws Exception {
         mockEndpoint.expectedMessageCount(1);
 
-        Patient patient = getPatient();
-        template.sendBody("direct:marshal", patient);
+        template.sendBody("direct:unmarshalErrorHandlerLenient", INPUT);
 
         mockEndpoint.assertIsSatisfied();
 
         Exchange exchange = mockEndpoint.getExchanges().get(0);
-        InputStream inputStream = exchange.getIn().getBody(InputStream.class);
-        IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream));
-        assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource));
-    }
-
-    private Patient getPatient() {
-        Patient patient = new Patient();
-        patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK"));
-        return patient;
+        Patient patient = (Patient) exchange.getIn().getBody();
+        assertEquals(1, patient.getExtension().size());
+        assertEquals(null, patient.getExtension().get(0).getUrl());
+        assertEquals("2011-01-02T11:13:15", patient.getExtension().get(0).getValueAsPrimitive().getValueAsString());
     }
 
     @Override
     protected AbstractApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml");
+        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatErrorHandlerSpringTest.xml");
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataFormatSpringTest.java
similarity index 98%
rename from components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java
rename to components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataFormatSpringTest.java
index f9fd05c..7c3dcd4 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirXmlDataFormatSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataFormatSpringTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.fhir;
+package org.apache.camel.component.fhir.dataformat.spring;
 
 import java.io.InputStream;
 import java.io.InputStreamReader;
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataformatErrorHandlerSpringTest.java
similarity index 50%
rename from components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java
rename to components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataformatErrorHandlerSpringTest.java
index e2a43f9..fb505c3 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirJsonDataFormatSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataformatErrorHandlerSpringTest.java
@@ -14,29 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.fhir;
+package org.apache.camel.component.fhir.dataformat.spring;
 
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.parser.DataFormatException;
+import org.apache.camel.CamelExecutionException;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.hl7.fhir.dstu3.model.Address;
-import org.hl7.fhir.dstu3.model.Base;
-import org.hl7.fhir.dstu3.model.HumanName;
 import org.hl7.fhir.dstu3.model.Patient;
-import org.hl7.fhir.instance.model.api.IBaseResource;
 import org.junit.Before;
 import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
+import static org.junit.Assert.assertEquals;
 
-    private static final String PATIENT = "{\"resourceType\":\"Patient\","
-            + "\"name\":[{\"family\":\"Holmes\",\"given\":[\"Sherlock\"]}],"
-            + "\"address\":[{\"line\":[\"221b Baker St, Marylebone, London NW1 6XE, UK\"]}]}";
+public class FhirXmlDataformatErrorHandlerSpringTest extends CamelSpringTestSupport {
+
+    private static final String INPUT = "<Patient><active value=\"true\"/><active value=\"false\"/></Patient>";
 
     private MockEndpoint mockEndpoint;
 
@@ -47,42 +42,30 @@ public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
         mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
     }
 
-    @Test
-    public void unmarshal() throws Exception {
-        mockEndpoint.expectedMessageCount(1);
-
-        template.sendBody("direct:unmarshal", PATIENT);
-
-        mockEndpoint.assertIsSatisfied();
-
-        Exchange exchange = mockEndpoint.getExchanges().get(0);
-        Patient patient = (Patient) exchange.getIn().getBody();
-        assertTrue("Patients should be equal!", patient.equalsDeep(getPatient()));
+    @Test(expected = DataFormatException.class)
+    public void unmarshalParserErrorHandler() throws Throwable {
+        try {
+            template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+        } catch (CamelExecutionException e) {
+            throw e.getCause();
+        }
     }
 
     @Test
-    public void marshal() throws Exception {
+    public void unmarshalLenientErrorHandler() throws Exception {
         mockEndpoint.expectedMessageCount(1);
 
-        Patient patient = getPatient();
-        template.sendBody("direct:marshal", patient);
+        template.sendBody("direct:unmarshalErrorHandlerLenient", INPUT);
 
         mockEndpoint.assertIsSatisfied();
 
         Exchange exchange = mockEndpoint.getExchanges().get(0);
-        InputStream inputStream = exchange.getIn().getBody(InputStream.class);
-        IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream));
-        assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource));
-    }
-
-    private Patient getPatient() {
-        Patient patient = new Patient();
-        patient.addName(new HumanName().addGiven("Sherlock").setFamily("Holmes")).addAddress(new Address().addLine("221b Baker St, Marylebone, London NW1 6XE, UK"));
-        return patient;
+        Patient patient = (Patient) exchange.getIn().getBody();
+        assertEquals(true, patient.getActive());
     }
 
     @Override
     protected AbstractApplicationContext createApplicationContext() {
-        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml");
+        return new ClassPathXmlApplicationContext("org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatErrorHandlerSpringTest.xml");
     }
-}
\ No newline at end of file
+}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/FhirDataFormatConfigSpringTest.xml b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/FhirDataFormatConfigSpringTest.xml
new file mode 100644
index 0000000..9d12969
--- /dev/null
+++ b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/FhirDataFormatConfigSpringTest.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+  <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <route>
+      <from uri="direct:marshalJson"/>
+      <unmarshal ref="fhirJson"/>
+      <to uri="mock:result"/>
+    </route>
+    <route>
+      <from uri="direct:marshalXml"/>
+      <marshal ref="fhirXml"/>
+      <to uri="mock:result"/>
+    </route>
+  </camelContext>
+
+  <bean id="fhirXml" class="org.apache.camel.model.dataformat.FhirXmlDataFormat">
+    <property name="parserErrorHandler" ref="errorHandler" />
+    <property name="parserOptions" ref="parserOptions" />
+    <property name="forceResourceId" ref="forceResourceId" />
+    <property name="fhirContext" ref="fhirContext"/>
+    <property name="serverBaseUrl" value="serverBaseUrl"/>
+    <property name="prettyPrint" value="TRUE" />
+    <property name="omitResourceId" value="TRUE" />
+    <property name="encodeElementsAppliesToChildResourcesOnly" value="TRUE" />
+    <property name="stripVersionsFromReferences" value="TRUE" />
+    <property name="overrideResourceIdWithBundleEntryFullUrl" value="TRUE" />
+    <property name="summaryMode" value="TRUE" />
+    <property name="suppressNarratives" value="TRUE" />
+    <property name="dontStripVersionsFromReferencesAtPaths">
+      <list>
+        <value>foo</value>
+        <value>bar</value>
+      </list>
+    </property>
+    <property name="preferTypes">
+      <list>
+        <ref bean="patient"/>
+      </list>
+    </property>
+    <property name="encodeElementsAppliesToResourceTypes">
+      <set>
+        <value>foo</value>
+        <value>bar</value>
+      </set>
+    </property>
+    <property name="encodeElements">
+      <set>
+        <value>foo</value>
+        <value>bar</value>
+      </set>
+    </property>
+    <property name="dontEncodeElements">
+      <set>
+        <value>foo</value>
+        <value>bar</value>
+      </set>
+    </property>
+  </bean>
+  <bean id="fhirJson" class="org.apache.camel.model.dataformat.FhirJsonDataFormat">
+    <property name="parserErrorHandler" ref="errorHandler" />
+    <property name="parserOptions" ref="parserOptions" />
+    <property name="forceResourceId" ref="forceResourceId" />
+    <property name="fhirContext" ref="fhirContext"/>
+    <property name="serverBaseUrl" value="serverBaseUrl"/>
+    <property name="prettyPrint" value="TRUE" />
+    <property name="omitResourceId" value="TRUE" />
+    <property name="encodeElementsAppliesToChildResourcesOnly" value="TRUE" />
+    <property name="stripVersionsFromReferences" value="TRUE" />
+    <property name="overrideResourceIdWithBundleEntryFullUrl" value="TRUE" />
+    <property name="summaryMode" value="TRUE" />
+    <property name="suppressNarratives" value="TRUE" />
+    <property name="dontStripVersionsFromReferencesAtPaths">
+      <list>
+        <value>foo</value>
+        <value>bar</value>
+      </list>
+    </property>
+    <property name="preferTypes">
+      <list>
+        <ref bean="patient"/>
+      </list>
+    </property>
+    <property name="encodeElementsAppliesToResourceTypes">
+      <set>
+        <value>foo</value>
+        <value>bar</value>
+      </set>
+    </property>
+    <property name="encodeElements">
+      <set>
+        <value>foo</value>
+        <value>bar</value>
+      </set>
+    </property>
+    <property name="dontEncodeElements">
+      <set>
+        <value>foo</value>
+        <value>bar</value>
+      </set>
+    </property>
+  </bean>
+
+  <bean id="fhirContext" class="ca.uhn.fhir.context.FhirContext" factory-method="forDstu3"/>
+  <bean id ="errorHandler" class="ca.uhn.fhir.parser.LenientErrorHandler"/>
+  <bean id="parserOptions" class="ca.uhn.fhir.context.ParserOptions" />
+  <bean id="forceResourceId" class="org.hl7.fhir.dstu3.model.IdType" />
+  <bean id="patient" class="org.hl7.fhir.dstu3.model.Patient" />
+
+</beans>
diff --git a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/FhirDataFormatDefaultConfigSpringTest.xml
similarity index 85%
copy from components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
copy to components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/FhirDataFormatDefaultConfigSpringTest.xml
index 6bc1f07..9263b30 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
+++ b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/FhirDataFormatDefaultConfigSpringTest.xml
@@ -23,20 +23,19 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
-
   <camelContext xmlns="http://camel.apache.org/schema/spring">
+    <dataFormats>
+      <fhirJson id="fhirJson"/>
+      <fhirXml id="fhirXml" />
+    </dataFormats>
     <route>
-      <from uri="direct:marshal"/>
-      <marshal>
-        <fhirJson fhirVersion="DSTU3"/>
-      </marshal>
+      <from uri="direct:marshalJson"/>
+      <marshal ref="fhirJson"/>
       <to uri="mock:result"/>
     </route>
     <route>
-      <from uri="direct:unmarshal"/>
-      <unmarshal>
-        <fhirJson/>
-      </unmarshal>
+      <from uri="direct:marshalXml"/>
+      <marshal ref="fhirXml"/>
       <to uri="mock:result"/>
     </route>
   </camelContext>
diff --git a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatErrorHandlerSpringTest.xml
similarity index 62%
copy from components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
copy to components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatErrorHandlerSpringTest.xml
index 6bc1f07..a837d9d 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
+++ b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatErrorHandlerSpringTest.xml
@@ -23,21 +23,30 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
-
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
-      <from uri="direct:marshal"/>
-      <marshal>
-        <fhirJson fhirVersion="DSTU3"/>
-      </marshal>
-      <to uri="mock:result"/>
+      <from uri="direct:unmarshalErrorHandlerStrict"/>
+      <unmarshal ref="strict"/>
+      <to uri="mock:errorIsThrown"/>
     </route>
     <route>
-      <from uri="direct:unmarshal"/>
-      <unmarshal>
-        <fhirJson/>
-      </unmarshal>
+      <from uri="direct:unmarshalErrorHandlerLenient"/>
+      <unmarshal ref="lenient"/>
       <to uri="mock:result"/>
     </route>
   </camelContext>
+
+  <bean id="strict" class="org.apache.camel.model.dataformat.FhirJsonDataFormat">
+    <property name="parserErrorHandler">
+      <bean class="ca.uhn.fhir.parser.StrictErrorHandler"/>
+    </property>
+    <property name="fhirContext" ref="fhirContext"/>
+  </bean>
+  <bean id="lenient" class="org.apache.camel.model.dataformat.FhirJsonDataFormat">
+    <property name="parserErrorHandler">
+      <bean class="ca.uhn.fhir.parser.LenientErrorHandler"/>
+    </property>
+    <property name="fhirContext" ref="fhirContext"/>
+  </bean>
+  <bean id="fhirContext" class="ca.uhn.fhir.context.FhirContext" factory-method="forDstu3"/>
 </beans>
diff --git a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
index 6bc1f07..4572a75 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
+++ b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
@@ -28,7 +28,7 @@
     <route>
       <from uri="direct:marshal"/>
       <marshal>
-        <fhirJson fhirVersion="DSTU3"/>
+        <fhirJson fhirVersion="DSTU3" prettyPrint="true"/>
       </marshal>
       <to uri="mock:result"/>
     </route>
diff --git a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatErrorHandlerSpringTest.xml
similarity index 62%
copy from components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
copy to components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatErrorHandlerSpringTest.xml
index 6bc1f07..d1d5563 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/json/FhirJsonDataFormatSpringTest.xml
+++ b/components/camel-fhir/camel-fhir-component/src/test/resources/org/apache/camel/dataformat/fhir/xml/FhirXmlDataFormatErrorHandlerSpringTest.xml
@@ -23,21 +23,30 @@
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     ">
-
   <camelContext xmlns="http://camel.apache.org/schema/spring">
     <route>
-      <from uri="direct:marshal"/>
-      <marshal>
-        <fhirJson fhirVersion="DSTU3"/>
-      </marshal>
-      <to uri="mock:result"/>
+      <from uri="direct:unmarshalErrorHandlerStrict"/>
+      <unmarshal ref="strict"/>
+      <to uri="mock:errorIsThrown"/>
     </route>
     <route>
-      <from uri="direct:unmarshal"/>
-      <unmarshal>
-        <fhirJson/>
-      </unmarshal>
+      <from uri="direct:unmarshalErrorHandlerLenient"/>
+      <unmarshal ref="lenient"/>
       <to uri="mock:result"/>
     </route>
   </camelContext>
+
+  <bean id="strict" class="org.apache.camel.model.dataformat.FhirXmlDataFormat">
+    <property name="parserErrorHandler">
+      <bean class="ca.uhn.fhir.parser.StrictErrorHandler"/>
+    </property>
+    <property name="fhirContext" ref="fhirContext"/>
+  </bean>
+  <bean id="lenient" class="org.apache.camel.model.dataformat.FhirXmlDataFormat">
+    <property name="parserErrorHandler">
+      <bean class="ca.uhn.fhir.parser.LenientErrorHandler"/>
+    </property>
+    <property name="fhirContext" ref="fhirContext"/>
+  </bean>
+  <bean id="fhirContext" class="ca.uhn.fhir.context.FhirContext" factory-method="forDstu3"/>
 </beans>
diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatConfiguration.java
index 2a7a71b..bf367e0 100644
--- a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirJsonDataFormatConfiguration.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.fhir.springboot;
 
+import java.util.List;
 import javax.annotation.Generated;
 import org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon;
 import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -43,6 +44,105 @@ public class FhirJsonDataFormatConfiguration
      */
     private String fhirVersion = "DSTU3";
     /**
+     * Sets the pretty print flag, meaning that the parser will encode resources
+     * with human-readable spacing and newlines between elements instead of
+     * condensing output as much as possible.
+     */
+    private Boolean prettyPrint = false;
+    /**
+     * Sets the server's base URL used by this parser. If a value is set,
+     * resource references will be turned into relative references if they are
+     * provided as absolute URLs but have a base matching the given base.
+     */
+    private String serverBaseUrl;
+    /**
+     * If set to true (default is false) the ID of any resources being encoded
+     * will not be included in the output. Note that this does not apply to
+     * contained resources, only to root resources. In other words, if this is
+     * set to true, contained resources will still have local IDs but the
+     * outer/containing ID will not have an ID.
+     */
+    private Boolean omitResourceId = false;
+    /**
+     * If provided, tells the parse which resource types to apply link
+     * setEncodeElements(Set) encode elements to. Any resource types not
+     * specified here will be encoded completely, with no elements excluded. The
+     * option is a java.util.Set<java.lang.String> type.
+     */
+    private String encodeElementsAppliesToResourceTypes;
+    /**
+     * If set to true (default is false), the values supplied to link
+     * setEncodeElements(Set) will not be applied to the root resource
+     * (typically a Bundle), but will be applied to any sub-resources contained
+     * within it (i.e. search result resources in that bundle)
+     */
+    private Boolean encodeElementsAppliesToChildResourcesOnly = false;
+    /**
+     * If provided, specifies the elements which should be encoded, to the
+     * exclusion of all others. Valid values for this field would include:
+     * Patient - Encode patient and all its children Patient.name - Encode only
+     * the patient's name Patient.name.family - Encode only the patient's family
+     * name .text - Encode the text element on any resource (only the very first
+     * position may contain a wildcard) .(mandatory) - This is a special case
+     * which causes any mandatory fields (min 0) to be encoded. The option is a
+     * java.util.Set<java.lang.String> type.
+     */
+    private String encodeElements;
+    /**
+     * If provided, specifies the elements which should NOT be encoded. Valid
+     * values for this field would include: Patient - Don't encode patient and
+     * all its children Patient.name - Don't encode the patient's name
+     * Patient.name.family - Don't encode the patient's family name .text -
+     * Don't encode the text element on any resource (only the very first
+     * position may contain a wildcard) DSTU2 note: Note that values including
+     * meta, such as Patient.meta will work for DSTU2 parsers, but values with
+     * subelements on meta such as Patient.meta.lastUpdated will only work in
+     * DSTU3 mode. The option is a java.util.Set<java.lang.String> type.
+     */
+    private String dontEncodeElements;
+    /**
+     * If set to true (which is the default), resource references containing a
+     * version will have the version removed when the resource is encoded. This
+     * is generally good behaviour because in most situations, references from
+     * one resource to another should be to the resource by ID, not by ID and
+     * version. In some cases though, it may be desirable to preserve the
+     * version in resource links. In that case, this value should be set to
+     * false. This method provides the ability to globally disable reference
+     * encoding. If finer-grained control is needed, use link
+     * setDontStripVersionsFromReferencesAtPaths(List)
+     */
+    private Boolean stripVersionsFromReferences = false;
+    /**
+     * If set to true (which is the default), the Bundle.entry.fullUrl will
+     * override the Bundle.entry.resource's resource id if the fullUrl is
+     * defined. This behavior happens when parsing the source data into a Bundle
+     * object. Set this to false if this is not the desired behavior (e.g. the
+     * client code wishes to perform additional validation checks between the
+     * fullUrl and the resource id).
+     */
+    private Boolean overrideResourceIdWithBundleEntryFullUrl = false;
+    /**
+     * If set to true (default is false) only elements marked by the FHIR
+     * specification as being summary elements will be included.
+     */
+    private Boolean summaryMode = false;
+    /**
+     * If set to true (default is false), narratives will not be included in the
+     * encoded values.
+     */
+    private Boolean suppressNarratives = false;
+    /**
+     * If supplied value(s), any resource references at the specified paths will
+     * have their resource versions encoded instead of being automatically
+     * stripped during the encoding process. This setting has no effect on the
+     * parsing process. This method provides a finer-grained level of control
+     * than link setStripVersionsFromReferences(Boolean) and any paths specified
+     * by this method will be encoded even if link
+     * setStripVersionsFromReferences(Boolean) has been set to true (which is
+     * the default)
+     */
+    private List<String> dontStripVersionsFromReferencesAtPaths;
+    /**
      * Whether the data format should set the Content-Type header with the type
      * from the data format if the data format is capable of doing so. For
      * example application/xml for data formats marshalling to XML, or
@@ -58,6 +158,107 @@ public class FhirJsonDataFormatConfiguration
         this.fhirVersion = fhirVersion;
     }
 
+    public Boolean getPrettyPrint() {
+        return prettyPrint;
+    }
+
+    public void setPrettyPrint(Boolean prettyPrint) {
+        this.prettyPrint = prettyPrint;
+    }
+
+    public String getServerBaseUrl() {
+        return serverBaseUrl;
+    }
+
+    public void setServerBaseUrl(String serverBaseUrl) {
+        this.serverBaseUrl = serverBaseUrl;
+    }
+
+    public Boolean getOmitResourceId() {
+        return omitResourceId;
+    }
+
+    public void setOmitResourceId(Boolean omitResourceId) {
+        this.omitResourceId = omitResourceId;
+    }
+
+    public String getEncodeElementsAppliesToResourceTypes() {
+        return encodeElementsAppliesToResourceTypes;
+    }
+
+    public void setEncodeElementsAppliesToResourceTypes(
+            String encodeElementsAppliesToResourceTypes) {
+        this.encodeElementsAppliesToResourceTypes = encodeElementsAppliesToResourceTypes;
+    }
+
+    public Boolean getEncodeElementsAppliesToChildResourcesOnly() {
+        return encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    public void setEncodeElementsAppliesToChildResourcesOnly(
+            Boolean encodeElementsAppliesToChildResourcesOnly) {
+        this.encodeElementsAppliesToChildResourcesOnly = encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    public String getEncodeElements() {
+        return encodeElements;
+    }
+
+    public void setEncodeElements(String encodeElements) {
+        this.encodeElements = encodeElements;
+    }
+
+    public String getDontEncodeElements() {
+        return dontEncodeElements;
+    }
+
+    public void setDontEncodeElements(String dontEncodeElements) {
+        this.dontEncodeElements = dontEncodeElements;
+    }
+
+    public Boolean getStripVersionsFromReferences() {
+        return stripVersionsFromReferences;
+    }
+
+    public void setStripVersionsFromReferences(
+            Boolean stripVersionsFromReferences) {
+        this.stripVersionsFromReferences = stripVersionsFromReferences;
+    }
+
+    public Boolean getOverrideResourceIdWithBundleEntryFullUrl() {
+        return overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    public void setOverrideResourceIdWithBundleEntryFullUrl(
+            Boolean overrideResourceIdWithBundleEntryFullUrl) {
+        this.overrideResourceIdWithBundleEntryFullUrl = overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    public Boolean getSummaryMode() {
+        return summaryMode;
+    }
+
+    public void setSummaryMode(Boolean summaryMode) {
+        this.summaryMode = summaryMode;
+    }
+
+    public Boolean getSuppressNarratives() {
+        return suppressNarratives;
+    }
+
+    public void setSuppressNarratives(Boolean suppressNarratives) {
+        this.suppressNarratives = suppressNarratives;
+    }
+
+    public List<String> getDontStripVersionsFromReferencesAtPaths() {
+        return dontStripVersionsFromReferencesAtPaths;
+    }
+
+    public void setDontStripVersionsFromReferencesAtPaths(
+            List<String> dontStripVersionsFromReferencesAtPaths) {
+        this.dontStripVersionsFromReferencesAtPaths = dontStripVersionsFromReferencesAtPaths;
+    }
+
     public Boolean getContentTypeHeader() {
         return contentTypeHeader;
     }
diff --git a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatConfiguration.java b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatConfiguration.java
index ce3c341..73fc5dc 100644
--- a/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-fhir-starter/src/main/java/org/apache/camel/component/fhir/springboot/FhirXmlDataFormatConfiguration.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.fhir.springboot;
 
+import java.util.List;
 import javax.annotation.Generated;
 import org.apache.camel.spring.boot.DataFormatConfigurationPropertiesCommon;
 import org.springframework.boot.context.properties.ConfigurationProperties;
@@ -43,6 +44,105 @@ public class FhirXmlDataFormatConfiguration
      */
     private String fhirVersion = "DSTU3";
     /**
+     * Sets the pretty print flag, meaning that the parser will encode resources
+     * with human-readable spacing and newlines between elements instead of
+     * condensing output as much as possible.
+     */
+    private Boolean prettyPrint = false;
+    /**
+     * Sets the server's base URL used by this parser. If a value is set,
+     * resource references will be turned into relative references if they are
+     * provided as absolute URLs but have a base matching the given base.
+     */
+    private String serverBaseUrl;
+    /**
+     * If set to true (default is false) the ID of any resources being encoded
+     * will not be included in the output. Note that this does not apply to
+     * contained resources, only to root resources. In other words, if this is
+     * set to true, contained resources will still have local IDs but the
+     * outer/containing ID will not have an ID.
+     */
+    private Boolean omitResourceId = false;
+    /**
+     * If provided, tells the parse which resource types to apply link
+     * setEncodeElements(Set) encode elements to. Any resource types not
+     * specified here will be encoded completely, with no elements excluded. The
+     * option is a java.util.Set<java.lang.String> type.
+     */
+    private String encodeElementsAppliesToResourceTypes;
+    /**
+     * If set to true (default is false), the values supplied to link
+     * setEncodeElements(Set) will not be applied to the root resource
+     * (typically a Bundle), but will be applied to any sub-resources contained
+     * within it (i.e. search result resources in that bundle)
+     */
+    private Boolean encodeElementsAppliesToChildResourcesOnly = false;
+    /**
+     * If provided, specifies the elements which should be encoded, to the
+     * exclusion of all others. Valid values for this field would include:
+     * Patient - Encode patient and all its children Patient.name - Encode only
+     * the patient's name Patient.name.family - Encode only the patient's family
+     * name .text - Encode the text element on any resource (only the very first
+     * position may contain a wildcard) .(mandatory) - This is a special case
+     * which causes any mandatory fields (min 0) to be encoded. The option is a
+     * java.util.Set<java.lang.String> type.
+     */
+    private String encodeElements;
+    /**
+     * If provided, specifies the elements which should NOT be encoded. Valid
+     * values for this field would include: Patient - Don't encode patient and
+     * all its children Patient.name - Don't encode the patient's name
+     * Patient.name.family - Don't encode the patient's family name .text -
+     * Don't encode the text element on any resource (only the very first
+     * position may contain a wildcard) DSTU2 note: Note that values including
+     * meta, such as Patient.meta will work for DSTU2 parsers, but values with
+     * subelements on meta such as Patient.meta.lastUpdated will only work in
+     * DSTU3 mode. The option is a java.util.Set<java.lang.String> type.
+     */
+    private String dontEncodeElements;
+    /**
+     * If set to true (which is the default), resource references containing a
+     * version will have the version removed when the resource is encoded. This
+     * is generally good behaviour because in most situations, references from
+     * one resource to another should be to the resource by ID, not by ID and
+     * version. In some cases though, it may be desirable to preserve the
+     * version in resource links. In that case, this value should be set to
+     * false. This method provides the ability to globally disable reference
+     * encoding. If finer-grained control is needed, use link
+     * setDontStripVersionsFromReferencesAtPaths(List)
+     */
+    private Boolean stripVersionsFromReferences = false;
+    /**
+     * If set to true (which is the default), the Bundle.entry.fullUrl will
+     * override the Bundle.entry.resource's resource id if the fullUrl is
+     * defined. This behavior happens when parsing the source data into a Bundle
+     * object. Set this to false if this is not the desired behavior (e.g. the
+     * client code wishes to perform additional validation checks between the
+     * fullUrl and the resource id).
+     */
+    private Boolean overrideResourceIdWithBundleEntryFullUrl = false;
+    /**
+     * If set to true (default is false) only elements marked by the FHIR
+     * specification as being summary elements will be included.
+     */
+    private Boolean summaryMode = false;
+    /**
+     * If set to true (default is false), narratives will not be included in the
+     * encoded values.
+     */
+    private Boolean suppressNarratives = false;
+    /**
+     * If supplied value(s), any resource references at the specified paths will
+     * have their resource versions encoded instead of being automatically
+     * stripped during the encoding process. This setting has no effect on the
+     * parsing process. This method provides a finer-grained level of control
+     * than link setStripVersionsFromReferences(Boolean) and any paths specified
+     * by this method will be encoded even if link
+     * setStripVersionsFromReferences(Boolean) has been set to true (which is
+     * the default)
+     */
+    private List<String> dontStripVersionsFromReferencesAtPaths;
+    /**
      * Whether the data format should set the Content-Type header with the type
      * from the data format if the data format is capable of doing so. For
      * example application/xml for data formats marshalling to XML, or
@@ -58,6 +158,107 @@ public class FhirXmlDataFormatConfiguration
         this.fhirVersion = fhirVersion;
     }
 
+    public Boolean getPrettyPrint() {
+        return prettyPrint;
+    }
+
+    public void setPrettyPrint(Boolean prettyPrint) {
+        this.prettyPrint = prettyPrint;
+    }
+
+    public String getServerBaseUrl() {
+        return serverBaseUrl;
+    }
+
+    public void setServerBaseUrl(String serverBaseUrl) {
+        this.serverBaseUrl = serverBaseUrl;
+    }
+
+    public Boolean getOmitResourceId() {
+        return omitResourceId;
+    }
+
+    public void setOmitResourceId(Boolean omitResourceId) {
+        this.omitResourceId = omitResourceId;
+    }
+
+    public String getEncodeElementsAppliesToResourceTypes() {
+        return encodeElementsAppliesToResourceTypes;
+    }
+
+    public void setEncodeElementsAppliesToResourceTypes(
+            String encodeElementsAppliesToResourceTypes) {
+        this.encodeElementsAppliesToResourceTypes = encodeElementsAppliesToResourceTypes;
+    }
+
+    public Boolean getEncodeElementsAppliesToChildResourcesOnly() {
+        return encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    public void setEncodeElementsAppliesToChildResourcesOnly(
+            Boolean encodeElementsAppliesToChildResourcesOnly) {
+        this.encodeElementsAppliesToChildResourcesOnly = encodeElementsAppliesToChildResourcesOnly;
+    }
+
+    public String getEncodeElements() {
+        return encodeElements;
+    }
+
+    public void setEncodeElements(String encodeElements) {
+        this.encodeElements = encodeElements;
+    }
+
+    public String getDontEncodeElements() {
+        return dontEncodeElements;
+    }
+
+    public void setDontEncodeElements(String dontEncodeElements) {
+        this.dontEncodeElements = dontEncodeElements;
+    }
+
+    public Boolean getStripVersionsFromReferences() {
+        return stripVersionsFromReferences;
+    }
+
+    public void setStripVersionsFromReferences(
+            Boolean stripVersionsFromReferences) {
+        this.stripVersionsFromReferences = stripVersionsFromReferences;
+    }
+
+    public Boolean getOverrideResourceIdWithBundleEntryFullUrl() {
+        return overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    public void setOverrideResourceIdWithBundleEntryFullUrl(
+            Boolean overrideResourceIdWithBundleEntryFullUrl) {
+        this.overrideResourceIdWithBundleEntryFullUrl = overrideResourceIdWithBundleEntryFullUrl;
+    }
+
+    public Boolean getSummaryMode() {
+        return summaryMode;
+    }
+
+    public void setSummaryMode(Boolean summaryMode) {
+        this.summaryMode = summaryMode;
+    }
+
+    public Boolean getSuppressNarratives() {
+        return suppressNarratives;
+    }
+
+    public void setSuppressNarratives(Boolean suppressNarratives) {
+        this.suppressNarratives = suppressNarratives;
+    }
+
+    public List<String> getDontStripVersionsFromReferencesAtPaths() {
+        return dontStripVersionsFromReferencesAtPaths;
+    }
+
+    public void setDontStripVersionsFromReferencesAtPaths(
+            List<String> dontStripVersionsFromReferencesAtPaths) {
+        this.dontStripVersionsFromReferencesAtPaths = dontStripVersionsFromReferencesAtPaths;
+    }
+
     public Boolean getContentTypeHeader() {
         return contentTypeHeader;
     }