Solved

reading and parsing remote xml-file in Mozilla

Posted on 2004-04-09
3
1,013 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
Comment Utility
text is not a valid w3c DOM property of a node. Try:
parseInt(oXML.firstChild.firstChild.nodeValue)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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-…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now