// Read it
$templateContent = readFromFile($FQFN);
+ // Init main arrays
+ $GLOBALS['__XML_CALLBACKS'] = array(
+ 'callbacks' => array(),
+ 'functions' => array()
+ );
+ $GLOBALS['__XML_ARGUMENTS'] = array();
+
// Handle it over to the parser
parseXmlData($templateContent);
if ((isset($GLOBALS['__XML_CALLBACKS']['functions'][$callback])) && (isset($GLOBALS['__XML_ARGUMENTS'][$callback]))) {
// Run all function callbacks
foreach ($GLOBALS['__XML_CALLBACKS']['functions'][$callback] as $function) {
+ // Trim all function names
+ $function = trim($function);
+
+ // If the function is empty, simply skip to the (maybe) next one
+ if (empty($function)) {
+ // Skip this
+ continue;
+ } // END - if
+
// Now construct the call-back function's name with 'Execute' at the end
$callbackName = $callback . 'Execute';
} // END - foreach
}
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
// Call-back functions for XML parser
-// ----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
// Starts an element
function startXmlElement ($resource, $element, $attributes) {
// Nothing to handle
return;
} // END - if
- die('characters[]='.strlen($characters));
+
+ // @TODO Handle characters
+ die(__FUNCTION__ . ':characters[]='.strlen($characters));
}
// Checks if given type is valid, makes all lower-case
$type = strtolower(trim($type));
// Is it found?
- return (in_array($type, array('string', 'array', 'bool')));
+ return (in_array($type, array('string', 'array', 'bool', 'int', 'callback')));
+}
+
+// Checks if given condition is valid
+function isXmlConditionValid ($condition) {
+ // Trim and make lower-case
+ $condition = trim(strtolower($condition));
+
+ // Is it valid?
+ return (in_array($condition, array('equals')));
}
// Checks if given value is valid/verifyable
return call_user_func_array($callbackFunction, array($value));
}
+// Converts given condition into a symbol
+function convertXmlContion ($condition) {
+ // Default is an invalid one
+ $return = '???';
+
+ // Detect the condition again
+ switch ($condition) {
+ case 'EQUALS': // Equals
+ $return = '=';
+ break;
+
+ default: // Unknown condition
+ debug_report_bug(__FUNCTION__, __LINE__, 'Condition ' . $condition . ' is unknown/unsupported.');
+ break;
+ } // END - switch
+
+ // Return it
+ return $return;
+}
+
// [EOF]
?>