A "DocumentRoot" means, that this directory on your local PC is the Root Directory / from the view of your Apache server. That means, all documents in /opt/xampp/htdocs/ are mapped to the root of Apache, what results in
http://localhost/ (and nothing more!).
If you have a file in your DocumentRoot like test.html, the full path on your local PC is /opt/lampp/htdocs/test.html - but from the view of Apache it is
http://localhost/test.htmlFinally, if you enter
http://localhost/opt/lampp/htdocs/test.html, this yields to the local path /opt/lampp/htdocs/opt/lampp/htdocs/test.html - what is nonsense as you easily can see. That is the idea of having a DocumentRoot, that you do not have to enter the full local path, as the root already yields to /opt/lampp/htdocs