PDO构造函数/ php [关闭]

Trouble is:

If I'm getting the constructor string (in string format) with all arguments from an xml file PDO fails with: could not find driver. pseudo: $pdo = new \PDO( registry::get('dsn') );

If I assign it to a variable and use the variable in the constructor, it fails again.

$dsn = registry::get('dsn');
$pdo = new \PDO( $dsn );

If I echo the very same string to screen and copy and paste it to the constructor all works fine.

Anyone had the same issue or has an idea what might cause the problem?

Random guess: The string is still wrapped in XML tags, e.g.:

<dsn>mysql:...</dsn>

When printing it to the browser, the tags are interpreted by it and not shown.