Database loading - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Database loading

I have several XML databases that need to be loaded.
I use the following code to do this:

[code=pre]
var xmlDoc = new ActiveXObject("microsoft.xmldom");
xmlDoc.load("GebruikersDatabase.xml");
alert('UserDatabase is being loaded...');

if(xmlDoc.readyState != 4) {
alert('UserDatabse could not be loaded.');
return;
}
[/code]

if I use this code it works alright, but it is very irritating that the alertbox appeares every time the database is being loaded. When I remove the first alertbox it still works on my own PC but when I upload the files to the Internet it doesn't work anymore.

First I thought there wasn't enought time for the database to be loaded, so I replaced the first alertbox with:
[code=pre]
for(x=0;x
;-)
-mac-
mailto:[email protected]
the Netherlands...

Comments

  • Tim ThackerTim Thacker Posts: 20Member
    Why not:

    Do While xmlDoc.ReadyState != 4
    'Do nothing
    loop


    Tim


    : I have several XML databases that need to be loaded.
    : I use the following code to do this:
    :
    : [code=pre]
    : var xmlDoc = new ActiveXObject("microsoft.xmldom");
    : xmlDoc.load("GebruikersDatabase.xml");
    : alert('UserDatabase is being loaded...');
    :
    : if(xmlDoc.readyState != 4) {
    : alert('UserDatabse could not be loaded.');
    : return;
    : }
    : [/code]
    :
    : if I use this code it works alright, but it is very irritating that the alertbox appeares every time the database is being loaded. When I remove the first alertbox it still works on my own PC but when I upload the files to the Internet it doesn't work anymore.
    :
    : First I thought there wasn't enought time for the database to be loaded, so I replaced the first alertbox with:
    : [code=pre]
    : for(x=0;x<100000;x++){
    : }
    : [/code]
    : but this didn't work either. Until now I still only have the alertbox as alternative.
    :
    : Does anyone now how I could do this simple thing without this stupid anoying alertbox...???
    :
    : please help me if you can because I'm going mad...
    :
    : (I've also placed this thread in the XML messagelist but noone seems to read those threads... so I hope you guys/girls can help me out...)
    :
    :
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :

  • mac_doggiemac_doggie Posts: 488Member
    Thanks for your reaction Tim,

    I tried this with and without the setTimeout:

    [code=pre]
    while(xmlDoc2.readyState != 4) {
    var ID = window.setTimeout(";",1000); // Just wait and do nothing
    };

    [/code]

    but When I run it without setTimeOut I can wait until next year but iExplorer just doesn't react anymore. And if I run it with setTimeOut The function doesn't go any further I also tried a window.setInterval but that didn't work either...


    HELP!!!!!



    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


  • Tim ThackerTim Thacker Posts: 20Member
    Let me see if I can get some free time this weekend to play with it. I'll let you know on Monday.

    Tim

    : Thanks for your reaction Tim,
    :
    : I tried this with and without the setTimeout:
    :
    : [code=pre]
    : while(xmlDoc2.readyState != 4) {
    : var ID = window.setTimeout(";",1000); // Just wait and do nothing
    : };
    :
    : [/code]
    :
    : but When I run it without setTimeOut I can wait until next year but iExplorer just doesn't react anymore. And if I run it with setTimeOut The function doesn't go any further I also tried a window.setInterval but that didn't work either...
    :
    :
    : HELP!!!!!
    :
    :
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :
    :

  • mac_doggiemac_doggie Posts: 488Member
    Thanxx I'd really apreciate that...


    : Let me see if I can get some free time this weekend to play with it. I'll let you know on Monday.

    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


  • Tim ThackerTim Thacker Posts: 20Member
    OK I ran into the same problems that you were having. It worked with and without the alert box popping. But the readyastate would not work inside the Do...Loop. Are you trying to load muliple XML files? If so check whether you want async set to true or false. DevGuru.com has a pretty good API on it. http://www.devguru.com/Technologies/xmldom/quickref/document_async.html. This will allow you to control whether processing haults while the file is loaded or continues.

    Hope this helps.

    Tim


    : Thanxx I'd really apreciate that...
    :
    :
    : : Let me see if I can get some free time this weekend to play with it. I'll let you know on Monday.
    :
    : ;-)
    : -mac-
    : mailto:[email protected]
    : the Netherlands...
    :
    :
    :

  • mac_doggiemac_doggie Posts: 488Member
    Yes, yes yes. Thank you, you've realy helped me.
    It works...



    : OK I ran into the same problems that you were having. It worked with and without the alert box popping. But the readyastate would not work inside the Do...Loop. Are you trying to load muliple XML files? If so check whether you want async set to true or false. DevGuru.com has a pretty good API on it. http://www.devguru.com/Technologies/xmldom/quickref/document_async.html. This will allow you to control whether processing haults while the file is loaded or continues.
    :
    : Hope this helps.
    :
    : Tim
    :
    :
    : : Thanxx I'd really apreciate that...
    : :
    : :
    : : : Let me see if I can get some free time this weekend to play with it. I'll let you know on Monday.
    : :
    : : ;-)
    : : -mac-
    : : mailto:[email protected]
    : : the Netherlands...
    : :
    : :
    : :
    :
    :

    ;-)
    -mac-
    mailto:[email protected]
    the Netherlands...


Sign In or Register to comment.