Note that there are some explanatory texts on larger screens.

plurals
  1. POCant traverse XML document
    primarykey
    data
    text
    <p>When I try to traverse to the children of the gallery node, it return nothing for the nodevalue, when it should read 'Joe Bloggs', and '#text' for the node name when it should read 'property'. Can anyone see what might be wrong with my javascript or XML.</p> <pre><code>&lt;gallery_index&gt; &lt;gallery id="0"&gt; &lt;property id="name"&gt;Joe Bloggs&lt;/property&gt; &lt;property id="description"&gt;&lt;p&gt;testtest&lt;/p&gt;&lt;/property&gt; &lt;property id="thumbnail_path"&gt;/images/thumb.jpg&lt;/property&gt; &lt;property id="weblink"&gt;http://www.cnn.com&lt;/property&gt; &lt;property id="client"&gt;&lt;/property&gt; &lt;assets/&gt; &lt;/gallery&gt; &lt;/gallery_index&gt; </code></pre> <p>Javascript.</p> <pre><code>// code for IE if (window.ActiveXObject){ xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null); } else { alert('Your browser cannot handle this script'); } xmlDoc.async=false; xmlDoc.load("../../../../../../../../xml/gallery_index.xml"); galleryIndexNode = xmlDoc.documentElement; galleryNode = galleryIndexNode.firstChild; alert(galleryNode.firstChild.nodeName); </code></pre> <p>EDIT:</p> <p>OK, changed the following javascript. The nodeName and nodeValue will display if I do this.</p> <pre><code>alert(galleryNode.childNodes[1].nodeName); </code></pre> <p>. . . . .</p> <pre><code>alert(galleryNode.childNodes[3].nodeName); </code></pre> <p>Is my XML badly formed? It displays in FF fine. What can i do to fix this?</p>
    singulars
    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.
    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