Project

General

Profile

Actions

Feature #59384

closed

Make GeneralUtility::xml2tree configurable

Added by Tizian Schmidlin almost 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-06-06
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Hello there,

I recently ran into a problem with GeneralUtility::xml2tree (formerly known as t3lib_div::xml2tree) where I tried to parse a file that had a tag that was empty. Now because of the strict behavior of xml2tree, the file failed to parse.

Indeed the xml parser is set to not skip white (empty) entries which leeds to an error and then stops parsing.

It would be nice to have the possibility to either modify the behavior of xml2tree globally or to have it to be configurable by parameters. Both could be implemented without risking backwards incompatibility.

Personally I'm a fan of the additional function parameters which I'd implement like this:

...
static public function xml2tree($string, $depth = 999, $caseFolding = 0, $skipWhite = 0) {
    $parser = xml_parser_create();
    $vals = array();
    $index = array();
    xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, $caseFolding);
    xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, $skipWhite);
...

Thank you for you're feedback!

Best Regards
Tizian

Actions

Also available in: Atom PDF