Closed VaclavSynacek closed 3 years ago
Small free form test:
(ql:quickload '(:plump :str)) (defun roundtrip (xml-string) (with-output-to-string (*standard-output*) (plump:serialize (plump:parse xml-string)))) (assert (str:starts-with-p "<?xml version=\"1.1\"" (roundtrip "<?xml version=\"1.1\" encoding=\"UTF-8\"?>"))) (assert (str:starts-with-p "<?xml version=\"1.1\"" (roundtrip "<?xml encoding=\"UTF-8\" version=\"1.1\"?>"))) (assert (str:starts-with-p "<?xml version=\"1.1\"" (roundtrip "<?xml version=\"1.1\""))) (assert (str:starts-with-p "<?xml version=\"1.0\"" (roundtrip "<?xml encoding=\"UTF-8\"?>")))
Your proposed solution would introduce a lot of unnecessary consing. I've fixed it up and cleaned some style issues.
Small free form test: