O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling Events While Loading XML Documents

Internet Explorer also lets you track the progress of an XML document as it's being loaded. In particular, you can use the onreadystatechange and ondataavailable events to watch what's happening. The readyState property in the onreadystatechange event informs you about the current status of a document. Here's an example showing how this works:

Listing . ch07_09.html
 <HTML> <HEAD> <TITLE> Handling document loading events </TITLE> <SCRIPT LANGUAGE="JavaScript"> var xmldoc function loadDocument() { xmldoc = new ActiveXObject("microsoft.XMLDOM") xmldoc.ondataavailable = dataAvailableHandler xmldoc.onreadystatechange = stateChangeHandler xmldoc.load('ch07_01.xml') } function dataAvailableHandler() { messageDIV.innerHTML ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required