XML Declaration does not allow attribute replacement

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

XML Declaration does not allow attribute replacement

sdietl
I need to set the encoding in the XML declaration. I tried it with the attribute replacement:
<?xml version="1.0" th:attr="encoding=${punchoutEncoding}"?>

which produces following exception:

aused by: org.attoparser.ParseException: (Line = 1, Column = 1) XML Declaration does not allow attribute with name "th:attr". Only "version", "encoding" and "standalone" are allowed (in that order): "<?xml version="1.0" th:attr="${punchoutEncoding}"?>"


Then I tried it with inline replacements: <?xml version="1.0" encoding="[[${punchoutEncoding}]]"?>

This doesn't cause an exception but just does not replace the placeholder.

Is there a way to do it with thymeleaf?

Thanks for help!