SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru ripcurlksm's Avatar
    Join Date
    Aug 2004
    Location
    San Clemente, CA
    Posts
    857
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why wont this work in FireFox?

    I am using JavaScript to parse XML. This works fine in IE but not in FireFox. In IE it prints the contents of the XML file but in FireFox it is just a blank window. I do not have JavaScript disabled in FireFox, so what could it be that would prevent it from parsing/printing?

    HTML Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
       <XML ID="customer" SRC="test.xml"></XML>
    
            <SCRIPT LANGUAGE="JavaScript">
                function viewData() 
                {
                    while (!customer.recordset.EOF) {
                        div1.innerHTML += 
                        customer.recordset("NAME") + 
                        " bought " + 
                        customer.recordset("PRODUCT_NAME") + 
                        " from the " + 
                        customer.recordset("DEPARTMENT") + 
                        " department.<BR>"
                        customer.recordset.moveNext()   
                    }
                }
            </SCRIPT>
    </head>
    
    <body onload="viewData();">
        
            <DIV ID="div1"></DIV>
    
    </body>
    </html>
    Here is text.xml, which is referenced in the above code.
    Code:
    <?xml version="1.0"?>
    <CUSTOMERS>
    
        <CUSTOMER>
            <NAME>Charles</NAME>
            <CUSTOMER_ID>58704</CUSTOMER_ID>
            <PURCHASE_DATE>10/15/2003</PURCHASE_DATE>
            <DEPARTMENT>Meat</DEPARTMENT>
            <PRODUCT_NAME>Ham</PRODUCT_NAME>
        </CUSTOMER>
    
        <CUSTOMER>
            <NAME>Franklin</NAME>
            <CUSTOMER_ID>58705</CUSTOMER_ID>
            <PURCHASE_DATE>10/15/2003</PURCHASE_DATE>
            <DEPARTMENT>Produce</DEPARTMENT>
            <PRODUCT_NAME>Tomatoes</PRODUCT_NAME>
        </CUSTOMER>
    
        <CUSTOMER>
            <NAME>Phoebe</NAME>
            <CUSTOMER_ID>58706</CUSTOMER_ID>
            <PURCHASE_DATE>10/15/2003</PURCHASE_DATE>
            <DEPARTMENT>Meat</DEPARTMENT>
            <PRODUCT_NAME>Turkey</PRODUCT_NAME>
        </CUSTOMER>
    
    </CUSTOMERS>

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <xml> is not a valid X/HTML element.

    Also, IE wrongly adds IDs to the global name-space. You should use document.getElementById() to get a reference to them.

    Try using the <object> element.
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •