Note that there are some explanatory texts on larger screens.

plurals
  1. POParsing XML Files doesn't work
    primarykey
    data
    text
    <p>I'm developing an app, where on the click of a button, the program calls information stored in an XML file to show in a <code>&lt;span&gt;</code> tag using JavaScript;</p> <pre><code> function viewXMLFiles() { console.log("viewXMLFiles() is running"); var xmlhttp = new HttpRequest(); xmlhttp.open("GET", "TestInfo.xml", false); xmlhttp.send; console.log("still running"); var xmlDoc = xmlhttp.responseXML; console.log("getting tired"); document.getElementById("documentList").innerHTML = xmlDoc.getElementByTagName("documentList")[0].childNodes[0].nodeValue; document.getElementById("documentList").innerHTML = xmlDoc.getElementByTagName("documentList")[1].childNodes[1].nodeValue; console.log("done"); } </code></pre> <p>and then the HTML to call it is (and where the XML file would be shown);</p> <pre><code>&lt;button onclick = "viewXMLFiles();"&gt;View Document Info&lt;/button&gt;&lt;br&gt; &lt;span id = "documentList"&gt; &lt;!--This is where the XML will be loaded into--&gt; &lt;/span&gt; </code></pre> <p>the XML file is;</p> <pre><code>&lt;document_list&gt; &lt;document&gt; &lt;document_name&gt;Holidays.pdf&lt;/document_name&gt; &lt;file_type&gt;.pdf&lt;/file_type&gt; &lt;file_location&gt;&lt;/file_location&gt; &lt;/document&gt; &lt;document&gt; &lt;document_name&gt;iPhone.jsNotes.docx&lt;/document_name&gt; &lt;file_type&gt;.docx&lt;/file_type&gt; &lt;file_location&gt;&lt;/file_location&gt; &lt;/document&gt; &lt;/document_list&gt; </code></pre> <p>In the console, the first message comes up, but nothing happens and thats all that appears. But i'm really (like, <em>really</em> new) to XML and parsing and don't understand what's wrong. Can you please help?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload