*/
public function parseXmlContent (string $content) {
// Convert all to UTF8
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: content()=%d - CALLED!', strlen($content)));
if (empty($content)) {
// No empty content
throw new InvalidArgumentException('content is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
$xmlParser = xml_parser_create();
// Force case-folding to on
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: Created xmlParser=%s ...', $xmlParser));
xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, TRUE);
// Set UTF-8
xml_set_character_data_handler($xmlParser, 'characterHandler');
// Now parse the XML tree
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: Invoking xml_parse(%s, content()=%d) ...', $xmlParser, strlen($content)));
if (!xml_parse($xmlParser, $content)) {
// Error found in XML
//* DEBUG: */ exit(__METHOD__ . ':<pre>'.htmlentities($content).'</pre>');
}
// Free the parser
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('XML-PARSER: Freeing xmlParser=%s ...', $xmlParser));
xml_parser_free($xmlParser);
+
+ // Trace message
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('XML-PARSER: EXIT!');
}
}
if (empty($stackerName)) {
// No empty stack name
throw new InvalidArgumentException('Parameter "stackerName" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (is_resource($value) || is_array($value) || is_object($value)) {
- // Unsupported variable type
- throw new InvalidArgumentException(sprintf('value[]=%s is not supported', gettype($value)), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Call the protected method
$value = parent::readVariable($key, 'general');
// Is this null?
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value[]=%s', gettype($value)));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value[]=%s', gettype($value)));
if (is_null($value)) {
// Bah, needs fixing.
$this->debugInstance(sprintf('[%s:%d]: key=%s returns NULL', __METHOD__, __LINE__, $key));
}
// Return value
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value=%s - EXIT!', $value));
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-XML-TEMPLATE-ENGINE: value=%s - EXIT!', $value));
return $value;
}
} elseif (empty($element)) {
// Throw IAE
throw new InvalidArgumentException('Parameter "element" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
- } elseif (count($attributes) == 0) {
- // Throw IAE
- throw new InvalidArgumentException(sprintf('Parameter attributes()=%d is an empty array', count($attributes)), FrameworkInterface::EXCEPTION_INVALID_ARGUMENT);
}
// Initial method name which will never be called...