January 20, 2002 - The Multiple States of XML Loading | 2
![]() |
January 20, 2002 The Multiple States of XML Loading Tips: January 2002
Yehuda Shiran, Ph.D.
|
DOMDocument object has a very extensive set of properties, methods, and events to deal with reading XML files and loading their data in. The readyState property can give direct feedback on the reading processes. Here are the possible values for readyState:
State Short Description Long Description
1 Loading Preparing to read the XML file. Did not try yet.
2 Loaded Reading and parsing the XML file. Object model still not available.
3 Interactive Part of the XML file successfully parsed and read in. Object model partially available for read only.
4 Completed Loading of the XML file has been completed, successfully or unsuccessfully.
When you read an XML file successfully, the readyState property goes through all four states: 1,2,3, and 4. When you are unsuccessful in reading an XML file, the readyState property may skip 3 on some operating systems. Obviously, it is very difficult to know exactly when the readyState property changes its value. For this very purpose the DOMDocument object provides the onreadystatechange event handler.


Find a programming school near you