+
+ /**
+ * Renders the given XML content
+ *
+ * @param $content Valid XML content or if not set the current loaded raw content
+ * @return void
+ * @throws XmlParserException If an XML error was found
+ */
+ public final function renderXmlContent ($content = null) {
+ // Is the content set?
+ if (is_null($content)) {
+ // Get current content
+ $content = $this->getRawTemplateData();
+ } // END - if
+
+ // Convert all to UTF8
+ $content = recode("html..utf8", $content);
+
+ // Get an XML parser
+ $xmlParser = xml_parser_create();
+
+ // Force case-folding to on
+ xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, true);
+
+ // Set object
+ xml_set_object($xmlParser, $this);
+
+ // Set handler call-backs
+ xml_set_element_handler($xmlParser, 'startElement', 'endElement');
+ xml_set_character_data_handler($xmlParser, 'characterHandler');
+
+ // Now parse the XML tree
+ if (!xml_parse($xmlParser, $content)) {
+ // Error found in XML!
+ //die("<pre>".htmlentities($content)."</pre>");
+ throw new XmlParserException(array($this, $xmlParser), BaseHelper::EXCEPTION_XML_PARSER_ERROR);
+ } // END - if
+
+ // Free the parser
+ xml_parser_free($xmlParser);
+ }