I try to load the following XML node into a DOMDocument:
Code:
<test value="1\n2\n3\n4\n5">test</test>
It is a big sorrow that DOMDocument::load() and DOMDocument::loadXML() of both replaces \n to five spaces (using php 5). Looking into the relevant RFC, \n is a perfectly valid character for XML attributes. Qt C++ and java handles it properly as well.

I see that there are options on load and loadXML to change certain behaviors, just I could not find out which one to use for this purpose.

So, how is it possible to force keeping end of line characters (replacing to PHP_EOL does not work either so DOMDocument is the nasty one, the incoming strings are alright). I have some code parsers where code is in the attribute so replacing/escaping is not really an option (of course, I could put there base64 and then decode at use, but that is a very high overhead). Must keep the EOLs.