]> git.mxchange.org Git - core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 17 Feb 2023 19:52:04 +0000 (20:52 +0100)
committerRoland Häder <roland@mxchange.org>
Fri, 17 Feb 2023 19:52:04 +0000 (20:52 +0100)
- no attributes of an XML element is very common (ops)
- fixed variable in debug line
- added more debug lines

framework/main/classes/parser/xml/class_XmlParser.php
framework/main/classes/stacker/fifo/class_FiFoStacker.php
framework/main/classes/template/xml/class_BaseXmlTemplateEngine.php

index bfbc88f54f37b164c2d6c21c4c5cf3f83a7f581e..a1ee38a78c7bbb78201932d64c0d050892f064fb 100644 (file)
@@ -70,6 +70,7 @@ class XmlParser extends BaseParser implements Parseable {
         */
        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);
@@ -88,6 +89,7 @@ class XmlParser extends BaseParser implements Parseable {
                $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
@@ -101,6 +103,7 @@ class XmlParser extends BaseParser implements Parseable {
                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>');
@@ -108,7 +111,11 @@ class XmlParser extends BaseParser implements Parseable {
                }
 
                // 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!');
        }
 
 }
index cf590a76e9b959a0ed614045ca42bb5e2514ba58..c19b614a43b5a22a5101d2d8907d885c3b465129 100644 (file)
@@ -72,9 +72,6 @@ class FiFoStacker extends BaseStacker implements Stackable {
                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
index a7063ec4496150843907d4d059e8a6dece2f5295..60c7ee6c83866386a8d34a515e309ed28242eb89 100644 (file)
@@ -286,14 +286,14 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine implements Compi
                $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;
        }
 
@@ -354,9 +354,6 @@ abstract class BaseXmlTemplateEngine extends BaseTemplateEngine implements Compi
                } 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...