Solved

reading and parsing remote xml-file in Mozilla

Posted on 2004-04-09
3
1,017 Views
Last Modified: 2007-12-19
I have these functions:

===================================
function LoadXMLFile(sURL) {
    var oXML;
    try {
        oXML = new ActiveXObject('Msxml2.DOMDocument');
    } catch(e) {oXML = false;}
    if(oXML) {
        //IE load XML document
        oXML.async = false;
        oXML.load(sURL);
        if(oXML.parseError.errorCode) {
            alert('error: ' + oXML.parseError.description);
            return false;
        }
    }
    if(!oXML) {
        //Mozilla load XML document
        try {
            oXML = document.implementation.createDocument("", "", null);
        } catch(e) {oXML = false;}
        if(oXML) {
            try {
                oXML.load(sURL);
            } catch(e) {oXML = false;}
        }
    }
    return oXML;
}



function ConfirmTask(iTaskId, iPersonId, oCheckbox) {
    var bChecked = oCheckbox.checked;
    var sURL = '../rooster/ConfirmPersonPlanning.asp?task_id='+iTaskId+'&person_id='+iPersonId+'&confirm='+bChecked;

    var oXML = LoadXMLFile(sURL);
    if(oXML) {
        var sResult = parseInt(oXML.firstChild.text);  // <<====== here is the line with the error
        alert(sResult);
        if(!sResult) {
            oCheckbox.checked = !oCheckbox.checked;
            alert('it did not work');
        } else {
            alert('ok');
        }
    } else {
        oCheckbox.checked = !oCheckbox.checked;
        alert('no support for this');
    }
    return false;
}
=======================

It works fine in IE, but Firebird (0.8)  returns an error

oXML.firstChild.text has no properties. Apparently something goes wrong the loading the XML. I looked at a lot of documentation, but i could not find a solution.

How can i make the thing work in Mozilla ??
0
Comment
Question by:sybe
3 Comments
 
LVL 12

Accepted Solution

by:
ahosang earned 250 total points
ID: 10793343
text is not a valid w3c DOM property of a node. Try:
parseInt(oXML.firstChild.firstChild.nodeValue)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question