*/
private $typePrefix = 'xml';
+ /**
+ * Name of stacker
+ */
+ private $stackerName = '';
+
/**
* Content from dependency
*/
// Init a variable stacker
$stackerInstance = ObjectFactory::createObjectByConfiguredName($typePrefix . '_' . $xmlTemplateType . '_stacker_class');
+ // Set name
+ $this->stackerName = $typePrefix . '_' . $xmlTemplateType;
+
// Init stacker
- $stackerInstance->initStacker($xmlTemplateType);
+ $stackerInstance->initStack($this->stackerName);
// Set it
$this->setStackerInstance($stackerInstance);
/**
* Load a specified XML template into the engine
*
- * @param $template The XML template we shall load
+ * @param $templateName Optional name of template
* @return void
*/
- public function loadXmlTemplate ($template) {
+ public function loadXmlTemplate ($templateName = '') {
+ // Is the template name empty?
+ if (empty($templateName)) {
+ // Set generic template name
+ $templateName = $this->typePrefix . '_' . $this->xmlTemplateType . '_template_type';
+ } // END - if
+
// Set template type
- $this->setTemplateType($this->getConfigInstance()->getConfigEntry($this->xmlTemplateType . '_template_type'));
+ $this->setTemplateType($this->getConfigInstance()->getConfigEntry($templateName));
// Load the special template
- $this->loadTemplate($template);
+ $this->loadTemplate($this->xmlTemplateType);
}
/**
return $this->mainNodes;
}
+ /**
+ * Getter for stacker name
+ *
+ * @return $stackerName Name of stacker of this class
+ */
+ protected final function getStackerName () {
+ return $this->stackerName;
+ }
+
/**
* Getter for sub node array
*
* @return void
*/
protected function handleTemplateDependency ($node, $templateDependency) {
+ // Check that node is not empty
+ assert(!empty($node));
+
// Is the template dependency set?
if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) {
// Get a temporay template instance
- $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance($this->typePrefix . '__' . $this->xmlTemplateType . '_template_class');
-
- // Create method name
- $methodName = 'load' . $this->convertToClassName($this->xmlTemplateType) . 'Template';
+ $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance($this->typePrefix . '_' . $this->convertDashesToUnderscores($node) . '_' . $this->xmlTemplateType . '_template_class');
// Then load it
- call_user_func(array($templateInstance, $methodName), $templateDependency);
+ $templateInstance->loadXmlTemplate($templateDependency);
// Parse the XML content
$templateInstance->renderXmlContent();
* @return void
* @throws XmlNodeMismatchException If current main node mismatches the closing one
*/
- public final function endElement ($resource, $nodeName) {
+ public final function finishElement ($resource, $nodeName) {
// Make all lower-case
$nodeName = strtolower($nodeName);