Quiz Number 12

SWE 432, Fall 2009
December 3


  1. Identify and explain the 2 different jobs that an XML validator does.
    Answer:
    Syntax: The first job is simply to make sure that the XML document is syntactically valid. That is, opening tags must match closing tags, and tags must be properly nested.

    Semantics: The second task is to compare an XML document against a formal definition in the form of either a DTD (Data Type Definition) or XML Schema. This ensures that the actual XML document conforms to the semantic restrictions imposed by the DTD or Schema.

  2. Describe the basic difference between the two types of XML parsing: the SAX approach and the DOM approach.
    Answer:
    The SAX approach is an event handling approach that calls an event handler as each part of an XML document is parsed. (This allows for convenient assignment of program variables to XML tag values.)

    The DOM approach parses the entire XML document at once and makes it available, as a whole, to the application that called the DOM parser. (The application can then access the XML hierarchy in exactly the same way that it would access DOM descriptions of HTML pages.)