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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML problem in Firefox 2.0 Advice Please

Status
Not open for further replies.

wellmoon

Technical User
Dec 6, 2006
28
GB
Hi,

I have a very basic xml file that has some customer names in it, like this:

Code:
<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
<!DOCTYPE customers [
  <!ELEMENT customers (customer+)>
  <!ELEMENT customer (name)>
  <!ELEMENT name (#PCDATA)>
]>
<customers>
  <customer>
    <name>Jon Doe</name>
  </customer>
  <customer>
    <name>Jane Doe</name>
  </customer>
</customers>
And I have a basic script file that opens the xml doc and gets the customer names:

Code:
function getxmldoc() {
  if (window.ActiveXObject) {
    doc = new ActiveXObject("Microsoft.XMLDOM");
    doc.async = false;
    doc.load("customers.xml");
    getnames();
  } else {
    doc = document.implementation.createDocument("","",null);
    doc.load("customers.xml");
    doc.onload = getnames;
  }
}
function getnames() {
  var names = doc.getElementsByTagName("name");
  alert(names.length);
  document.close();
}

The code works beautifully in IE7 and alerts '2' but Firefox (v2.0) alerts '0'

Why is this happening?
 
My ff(v1.0) shows up 2 just fine, so I cannot reproduce the problem.
 
wierd, my FF version 1.0 also alerts '2'. I reinstalled FF v2.0 but this hasn't helped, I also checked the options and couldn't see anything regarding XML.

I've used XML with FF before without any problems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top