[Project_owners] Reading siblings in XML..

Jawahar Swaminathan jawahar at ebi.ac.uk
Mon Feb 21 21:12:58 EST 2005


I have an XML file which looks somewhat like this

<Group name="Structures">
<Menuitem Identity="Text Search">

I try to read all the URL's under a particular Menuitem using the following:

var value = document.getElementById('queryTextbox').value; // This is an 
option chosen by the User
var bbdatabase = xmlDoc.getElementsByTagName("Menuitem");
for(var i=0; i<bbdatabase.length; i++) {
var MenuTerm = bbdatabase[i].attributes["Identity"].value;
        if(MenuTerm == value)
            var urlT = 
            for(var l=0; l<urlT.length; l++) {

I would expect this to open the two URLs in the XML file. But I seem to 
get into this endless loop with only the first URL read in everytime. 
Obviously I am doing something very stupid. I read somewhere that I 
should probably be using getNextSibling but I have no idea how to do 
this. Any help much appreciated as usual.



More information about the Project_owners mailing list