Why do I sometimes have problems loading or including a document from a URL (or whats this talk about async vs. synch)?
If you attempt to load an XMLDOM using the loadXML() method, the default behavior of the method is to load asynchronously. This means that the DOM starts loading, and immediately returns control to you. Unfortunately this means that you may attempt to use the DOM before it is loaded, resulting in annoying errors. There are two things you can do to prevent this situation. First, you can always tell the DOM to load synchronously (that is, wait for the document to finish loading before moving on to the next line of code) by setting the property async = False. This is how the load is accomplished in the code sample here. If you want the DOM to load asynchronously, you can always check to make sure that the property readyState = True before reading the DOM.