Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading XML objects in Netscape 6+

Status
Not open for further replies.

Shipslitz

Programmer
Jul 21, 2003
10
US
Okay people...I've been seriously losing sleep over this one!! I've got this GREAT application that is working in IE and I need to support Netscape. Please, Netscape programmers....help! ;)

Basically, I JUST CAN'T seem to parse an XML file in Netscape 6+. Even the VERY BASIC doesn't seem to work. (Hmm...so think of something very ABSTRACT - some minute detail that might CAUSE this not to work; because from what I've seen online...this is supposed to work.) For example:
------------------------------------------------------------
Here's an example of what the XML looks like:
<menus>
<vendors>
<vendor>Brocade</vendor>
<vendor>Cisco</vendor>
<vendor>Emulex</vendor>
<vendor>LSI</vendor>
<vendor>Microsoft</vendor>
<vendor>Novell</vendor>
<vendor>Oracle</vendor>
<vendor>Sun</vendor>
</vendors>
.
. (more elements)
.
</menus>

And here's the code to connect:

var xmlDoc = document.implementation.createDocument(&quot;&quot;,&quot;&quot;,null);
xmlDoc.load(&quot;compatible_list.xml&quot;);
var vendor_list = xmlDoc.getElementsByTagName('vendor');
alert( vendor_list[0].nodeValue );
------------------------------------------------------------

I understand the different methods used for parsing: childNodes, nodeValue, nodeName, appendChild, firstChild, lastChild, etc... and have used just about every method (and arrangements of methods) possible.

My Error (which is SOOOOO frustrating) is:

&quot;vendor_list[0] has no properties&quot;

Thus, statements like &quot;vendor_list.length&quot; will create an error.

This works 100% in IE 5+. But I've been trying for DAYS to get this to work in NS 6+...and it's just not working.

I'm at my wits end. Am I doing something wrong!? Any help would be greatly appreciated.
Thanks so much!
Ship
 
Hmm...I guess I should try and clarify things (because I STILL haven't found an answer to this):

In the following line of code, does anyone know what the parameters for this function are? (Sure, there are tons of examples on the web...but what is the meaning of each parameter?)

var xmlDoc_test = document.implementation.createDocument('', '', null);

Also, from my previous post: it looks as though the XML file isn't being loaded correctly because the XML object doesn't have any properties. (Hence the error: &quot;vendor_list[0] has no properties&quot; ) HOWEVER, there is no error given to indicate the file didn't load correctly. Has ANYONE run into this problem? Is there something that I need to do with my developing environment to make sure this works? I can't even seem to find anyone with this same problem.

Needing a Savior...
Ship
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top