You can assemble multiple XDP fragments into a single XDP document.
For example, consider XDP fragments where each XDP file contains one
or more subforms used to create a health form. The following illustration shows
the outline view (represents the tuc018_template_flowed.xdp file
used in the Assembling multiple XDP fragments quick start):
The following illustration shows the patient section (represents
the tuc018_contact.xdp file used in the Assembling multiple XDP fragments quick
start):
The following illustration shows the patient health section (represents
the tuc018_patient.xdp file used in the Assembling multiple XDP fragments quick
start):
This fragment contains two subforms named subPatientPhysical and subPatientHealth.
Both of these sub forms are referenced in the DDX document that
is passed to the Assembler service. Using the Assembler service, you
can combine all of these XDP fragments into a single XDP document,
as shown in the following illustration.
The following DDX document assembles multiple XDP fragments into
an XDP document.
<?xml version="1.0" encoding="UTF-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<XDP result="tuc018result.xdp">
<XDP source="tuc018_template_flowed.xdp">
<XDPContent insertionPoint="ddx_fragment" source="tuc018_contact.xdp" fragment="subPatientContact" required="false"/>
<XDPContent insertionPoint="ddx_fragment" source="tuc018_patient.xdp" fragment="subPatientPhysical" required="false"/>
<XDPContent insertionPoint="ddx_fragment" source="tuc018_patient.xdp" fragment="subPatientHealth" required="false"/>
</XDP>
</XDP>
</DDX>
The DDX document contains an XDP result tag
that specifies the name of the result. In this situation, the value
is tuc018result.xdp. This value is referenced in
the application logic that is used to retrieve the XDP document
after the Assembler service returns the result. For example, consider
the following Java application logic that is used to retrieve the
assembled XDP document (notice the value is bolded):
//Iterate through the map object to retrieve the result XDP document
for (Iterator i = allDocs.entrySet().iterator(); i.hasNext();) {
// Retrieve the Map object's value
Map.Entry e = (Map.Entry)i.next();
//Get the key name as specified in the
//DDX document
String keyName = (String)e.getKey();
if (keyName.equalsIgnoreCase("tuc018result.xdp"))
{
Object o = e.getValue();
outDoc = (Document)o;
//Save the result PDF file
File myOutFile = new File("C:\\AssemblerResultXDP.xdp");
outDoc.copyToFile(myOutFile);
}
}
The XDP source tag specifies the XDP file that
represents a complete XDP document that can be used as a container
for adding XDP fragments or as one of a number of documents that
are appended together in order. In this situation, the XDP document
is used only as a container (the first illustration shown in Assembling Multiple XDP Fragments).
That is, the other XDP files are placed within the XDP container.
For each sub form, you can add an XDPContent element
(this element is optional). In the above example, notice that there
are three sub forms: subPatientContact, subPatientPhysical,
and subPatientHealth. Both the subPatientPhysical subform
and the subPatientHealth sub form are located in
the same XDP file, tuc018_patient.xdp. The fragment element specifies
the name of the sub form, as defined in Designer.