The serializeDataElements class is used to serialize XML
data by setting values of all DDEs, PH and Field elements. This
serialized XML can then be consumed by the Generate a Letter PDF
API to render the letter. This appends PH and Field data (provided
as maps) to the DDI (provided as XML). You can use this API to provide variable
and field values before rendering the letter. The values of DDEs
are described in this table:
DDE
|
Description
|
ddiDataAsXml
|
The DDI data as XML.
|
phValues
|
A map containing the variable name versus
its value.
|
fieldValues
|
A map containing the somExpr of Field versus
the value of the Field.
|
The serializeDataElements syntax is as follows:
public String serializeDataElementsToXML(String ddiDataAsXml,Map<String,Object> phValues,Map<String,Object> fieldValues)
The XML data given to LetterRenderService.renderLetter() APIs
data will have additional elements in following format, where values
of place holder variables and fields will be provided.
<data-root>
...
<fields> <!--starting element for fields -->
<field name="field1">value1</field> <!-- field's display-name is field1 and its value is set to value1. -->
<field name="field2" somExpr="xfa[0].template[0].field2">value2</field> <!-- Attribute somexpr is optional and can be used when display name is not sufficient to identify field uniquely -->
...
</fields>
<variables> <!--starting element for place holder variables-->
<variable name="var1">value1</variable> <!-- variable name is var1 and its value is set to value1 -->
....
</variables>
</data-root>
The DDEs values are provided as part of XML data. The
renderLetter()
will consider
values provided with XML data and if there is value available for
corresponding DDE/PH/Field then these values will be set for these
DDE/PH/Field. All other values will be resolved through Binding.
The field/variable binding will not be considered if XML data is
available for variables or fields. For example if a Field is bound
to unprotected DD, and if the value for that Field is specified
in the xml data then specified value will be used for rendering
letter.When no value is set as part of XML data, in that case values
of variables/Fields will be set as was previously the case (using
bindings if present) and empty in case of binding "User". For example
if a Variable is bound to unprotected DD, and no value specified
(not xml node for the variable) in xml data, in that case as per
binding the DD value will be used when rendering letter.