Output for the validateNode Example

 

When you build and run the validateNode code, you should get the following output, displayed in three message boxes.

  • The first message box contains the following text:
invalid dom:  
Element 'review' is unexpected according to content model of parent element 'book'.  
Expecting: price.  

This message is the result of using the import() method to import the entire DOM object.

  • The second message is the output from the validateNode method when it is applied to the first <book> node, which is valid against the schema:

    <book id="bk001">
         <author>Hightower, Kim</author>
         <title>The First Book</title>
         <genre>Fiction</genre>
         <price>44.95</price>
         <pub_date>2000-10-01</pub_date>
         <review>An amazing story of nothing</review>
    </book>
    
  • The final message is the output from the validateNode method when it is applied to the second <book> node, which is invalid against the schema:

invalid node:  
Element 'review' is unexpected according to content model of parent element 'book'.  
Expecting: price.