I have code that successfully displays results, but throws an error in
Fx 3 and IE 6.

A sample of the XML file:

<?xml version="1.0" encoding="ISO-8859-1"?>
<mycds>
<cd>
        <title>Wolf City</title>
        <artist>Amon Duul II</artist>
        <artist_id>1</artist_id>
        <track_id>1</track_id>
        <sequence>1</sequence>
        <track_name> Surrounded By The Stars</track_name>
        <track_id>2</track_id>
        <sequence>2</sequence>
        <track_name> Green Bubble Raincoated Man</track_name>
        <track_id>3</track_id>
        <sequence>3</sequence>
        <track_name> Jail-House-Frog</track_name>
        <track_id>4</track_id>
        <sequence>4</sequence>
        <track_name> Wolf City</track_name>
        <track_id>5</track_id>
        <sequence>5</sequence>
        <track_name> Wie Der Wind Am Ende Einer Strabe</track_name>
        <track_id>6</track_id>
        <sequence>6</sequence>
        <track_name> Deutsch Nepal</track_name>
        <track_id>7</track_id>
        <sequence>7</sequence>
        <track_name> Sleepwalker's Timeless Bridge</track_name>
</cd>
</mycds>

I get the sequence and tracks with code like this:

var x=xmlDoc.getElementsByTagName("cd");

function show(i)
{
for (j=0; j < tracks.length; j++)
{
sequence = x[i].getElementsByTagName("sequence")
[j].childNodes[0].nodeValue;
.
.
.

}
}

But that produces the error:
Error: x.getElementsByTagName("sequence")[j] is undefined

Note: var i is successfully passed in.

As mentioned, the code works - but throws an error.
Can someone shed some light on why this might be getting the error,
and how to 'correct' it?

Haven't you received enough replies here? Please refrain from double posting or at least let us know you have posted somewhere else so that multiple people don't end up wasting their time for coming up with the solution of a same problem.

Haven't you received enough replies here? Please refrain from double posting or at least let us know you have posted somewhere else so that multiple people don't end up wasting their time for coming up with the solution of a same problem.

Yes, I have received replies in that newsgroup, but no solution as yet. And no solutions here either. If I had a solution, it would have been noted and posted here. Thanks for your help. You can delete this thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.