We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The XML writer doesn't work on XML that contains attributes. I discovered this trying to modify my phpunit.xml.
phpunit.xml
Here's a passing test case with one of the project's own mocks:
$raw = <<<RAW <?xml version="1.0" encoding="UTF-8"?> <config> <application> <name>configuration</name> <secret>s3cr3t</secret> </application> <host>localhost</host> <port>80</port> <servers> <server1>host1</server1> <server2>host2</server2> <server3>host3</server3> </servers> </config> RAW; $config = new \Noodlehaus\Config($raw, new \Noodlehaus\Parser\Xml(), TRUE); $xml = $config->toString(new \Noodlehaus\Writer\Xml(), TRUE); print $xml;
Result:
<?xml version="1.0"?> <config> <application> <name>configuration</name> <secret>s3cr3t</secret> </application> <host>localhost</host> <port>80</port> <servers> <server1>host1</server1> <server2>host2</server2> <server3>host3</server3> </servers> </config>
Add an attribute to any element in the XML, and it will fail:
$raw = <<<RAW <?xml version="1.0" encoding="UTF-8"?> <config test="example"> <application> <name>configuration</name> <secret>s3cr3t</secret> </application> <host>localhost</host> <port>80</port> <servers> <server1>host1</server1> <server2>host2</server2> <server3>host3</server3> </servers> </config> RAW; $config = new \Noodlehaus\Config($raw, new \Noodlehaus\Parser\Xml(), TRUE); $xml = $config->toString(new \Noodlehaus\Writer\Xml(), TRUE); var_dump($xml);
<?xml version="1.0"?>
The text was updated successfully, but these errors were encountered:
Hi, @TravisCarden. Thanks for opening this issue! I'll work on a fix.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
The XML writer doesn't work on XML that contains attributes. I discovered this trying to modify my
phpunit.xml
.Here's a passing test case with one of the project's own mocks:
Result:
Add an attribute to any element in the XML, and it will fail:
Result:
The text was updated successfully, but these errors were encountered: