Just to answer your question with a somewhat usable answer, and what I think most developers probably would do in the real world, is to use a library like JQuery.
In this case, the code is straightforward:
Your HTML:
<div id="result"></div>
Your Javascript:
$(function() { $('#result').load('test.xml'); } );
You need to make sure that your test xml file is served on the same domain as your javascript file.
2
solved Step by step tutorial in javascript [closed]