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:

 <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('meetings.xml') } function dataAvailableHandler() { messageDIV.innerHTML += ...

Get Inside XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.