473,325 Members | 2,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

parseError.reason Mozilla equivalent

Hi All,

I am calling load() on a xml document object and I would like to test
if there was any exception. Is there an equivalent to
xmlDocument.parseError.reason in Mozilla/FF1.5+ ?

So far I've tried to try/catch and tested load return value (nothing
gets returned in FF) for a wrong uri.

Any hints?!

Regards,
Sebastian

Jul 25 '06 #1
1 2543

Sebastian Feher wrote:
Hi All,

I am calling load() on a xml document object and I would like to test
if there was any exception. Is there an equivalent to
xmlDocument.parseError.reason in Mozilla/FF1.5+ ?

So far I've tried to try/catch and tested load return value (nothing
gets returned in FF) for a wrong uri.

Any hints?!

Regards,
Sebastian
Here's the code I have so far:

function importXml(uri, callbackFn )
{
var xmlDoc;
if (document.implementation && document.implementation.createDocument)
{
xmlDoc = document.implementation.createDocument('', 'dummy-root',
null);
if (callbackFn)
{
xmlDoc.async = true;
xmlDoc.addEventListener( 'load', callbackFn, false );

var loaded = xmlDoc.load(uri /*, false */);
}
else
{
xmlDoc.async = false;
xmlDoc.load(uri /*, false */);
return xmlDoc;
}
}
else if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.setProperty("SelectionLanguage", "XPath");

if (callbackFn)
{
xmlDoc.async = true;
xmlDoc.onreadystatechange = function ()
{
if (xmlDoc.parseError.errorCode !== 0)
{
throw xmlDoc.parseError.reason + ': ' + xmlDoc.parseError.url;
}
if (xmlDoc.readyState == 4)
{
callbackFn(xmlDoc);
}
};
xmlDoc.load(uri);
}
else
{
xmlDoc.async = false;
var loaded = xmlDoc.load(uri);
if (xmlDoc.parseError.errorCode !== 0)
{
throw xmlDoc.parseError.reason + ': ' + xmlDoc.parseError.url;
}
ASSERT('Xml document not loaded: ' + uri, loaded);

return xmlDoc;
}
}
else
{
throw 'Browser not supported.';
}
}

Currently my code lets me know if there was an error ( e.g. wrong url
for the XML ) in IE and would like to have the same behaviour in FF
also.

I hope this cleared up a bit my intention.

Regards,
Sebastian

Jul 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bart Van Loon | last post by:
Hi, I am playing around with native MathML viewing in Mozilla and am wondering the following: When I name my file helloworld.xml the presentation <math> in it gets rendered correctly, when I...
2
by: Curtis Rempel | last post by:
I'm using the cascademenu.js file from http://javascript.internet.com/navigation/cascade-menu.html It works fine with IE but nothing happens with Mozilla. Specifically, when I open the...
6
by: Red_Indian | last post by:
Hi How do I accomplish the following functionality in Mozilla/ Firefox: document.form.textbox.disabled = false if I want to conditionally enable a text box that was disabled by default. ...
3
by: Will | last post by:
Hi, I am looking for a way to start a trusted Linux application (a C executable) on my local machine, upon clicking a link. Basically the equivalent of the ActiveXObject in IE. Thank you. Will
8
by: Nicolás Lichtmaier | last post by:
Hi, some time ago I've written an article about this issue. It explain some differences in Explorer's and Mozilla's JavaScript/DOM. It has recently changed its URL, This is the new one: ...
7
by: Mark Szlazak | last post by:
Is there anything for Mozilla or Firefox that would be equivalent to IE's onpaste event for a textarea?
49
by: Aidan | last post by:
I rely heavily on MSDN for documentation when it comes to HTML/DHTML/JavaScript/CSS but as a result I often have problems getting my stuff to work in Netscape/Mozilla/Firefox. I like the MSDN...
4
by: Darren | last post by:
Hi. I have a javascript menu system which uses the "elementFromPoint" function. However Netscape/Mozilla doesn't recognise this function. Does it have an equivilent? Thanks -- Darren
10
by: News | last post by:
I have a page up trying to learn how to ID a browser and other info. http://wyght.com/warren/testPos.html here is the code <script type = "text/javascript"> var space = ", "; var name...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.