Reading the <Book> Nodes of the Catalog Database

Change the StartLoading() function in Listing 9.3 as shown in Listing 9.6.

Listing 9.6 Stepping Through the <Book> Nodes of the <Catalog> Database
 1: function StartLoading() 2: { 3: // This node is for storing node for later use. 4: var holdNode; 5: RootElement1=xmlDoc1.documentElement; 6: // If the attempt to extract the document fails, we flag it 7: // with both an alert box and a message written to the web 8: // page. Once the messages are completed, the return is 9: // executed and the program terminates. 10: if(RootElement1==null) 11: { 12: alert("The root node is null"); 13: document.write("<B><BIG>The data of the XML file cannot be accessed</BIG></B><BR>"); 14: return; 15: } 16: // In ...

Get Sams Teach Yourself XML in 24 Hours 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.