- /**
- * Load a specified announcement-answer template into the engine
- *
- * @param $template The announcement-answer template we shall load which is
- * located in 'announcement_answer' by default
- * @return void
- */
- public function loadAnnouncementAnswerTemplate ($template = 'announcement_answer') {
- // Set template type
- $this->setTemplateType($this->getConfigInstance()->getConfigEntry('node_announcement_answer_template_type'));
-
- // Load the special template
- $this->loadTemplate($template);
- }
-
- /**
- * Getter for current main node
- *
- * @return $currMainNode Current main node
- */
- public final function getCurrMainNode () {
- return $this->curr['main_node'];
- }
-
- /**
- * Setter for current main node
- *
- * @param $element Element name to set as current main node
- * @return $currMainNode Current main node
- */
- private final function setCurrMainNode ($element) {
- $this->curr['main_node'] = (string) $element;
- }
-
- /**
- * Getter for main node array
- *
- * @return $mainNodes Array with valid main node names
- */
- public final function getMainNodes () {
- return $this->mainNodes;
- }
-
- /**
- * Getter for sub node array
- *
- * @return $subNodes Array with valid sub node names
- */
- public final function getSubNodes () {
- return $this->subNodes;
- }
-
- /**
- * Handles the start element of an XML resource
- *
- * @param $resource XML parser resource (currently ignored)
- * @param $element The element we shall handle
- * @param $attributes All attributes
- * @return void
- * @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
- */
- public function startElement ($resource, $element, array $attributes) {
- // Initial method name which will never be called...
- $methodName = 'initAnnouncementAnswer';
-
- // Make the element name lower-case
- $element = strtolower($element);
-
- // Is the element a main node?
- //* DEBUG: */ echo "START: >".$element."<<br />\n";
- if (in_array($element, $this->getMainNodes())) {
- // Okay, main node found!
- $methodName = 'start' . $this->convertToClassName($element);
-
- // Set it
- $this->setCurrMainNode($element);
- } elseif (in_array($element, $this->getSubNodes())) {
- // Sub node found
- $methodName = 'start' . $this->convertToClassName($element);
- } else {
- // Invalid node name found
- throw new InvalidXmlNodeException(array($this, $element, $attributes), XmlParser::EXCEPTION_XML_NODE_UNKNOWN);
- }
-
- // Call method
- call_user_func_array(array($this, $methodName), $attributes);
- }
-
- /**
- * Ends the main or sub node by sending out the gathered data
- *
- * @param $resource An XML resource pointer (currently ignored)
- * @param $nodeName Name of the node we want to finish
- * @return void
- * @throws XmlNodeMismatchException If current main node mismatches the closing one
- */
- public function endElement ($resource, $nodeName) {
- // Make all lower-case
- $nodeName = strtolower($nodeName);
-
- // Does this match with current main node?
- //* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
- if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
- // Did not match!
- throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), XmlParser::EXCEPTION_XML_NODE_MISMATCH);
- } // END - if
-
- // Construct method name
- $methodName = 'finish' . $this->convertToClassName($nodeName);
-
- // Call the corresponding method
- //* DEBUG: */ echo "call: ".$methodName."<br />\n";
- call_user_func_array(array($this, $methodName), array());
- }
-