Template references allow commonly occurring elements to be defined once in a single template and reused in other templates. When loading multiple templates that include template references, referenced templates must be loaded first or defined higher up in a message template definition.
The XMLMessageTemplateLoaderloads message templates defined in XML. The loader does not currently use Schema validation to verify the message template definitions.
A single instance of this class will keep track of the message templates that it has loaded from previous calls to the loadmethod. Therefore template references do not have to reference templates defined within the same file. In the case where templates referenced have not been loaded from the same loader, the setTemplateRepository method can be used to set the repository where the referenced templates are stored.
Loading Templates Between Multiple Loaders
Given two template loaders, A and B: In the case where a template being loaded by B references a template loaded by A, the following code will successully locate the referenced template.
MessageTemplateLoader A = new XMLMessageTemplateLoader(); MessageTemplate[] Atemplates = A.load(aStream); MessageTemplateLoader B = new XMLMessageTemplateLoader(); B.setTemplateRepository(A.getTemplateRegistry()); MessageTemplate[] Btemplates = B.load(bStream); |