1. A DOM is an interface that allows scripts and programs to dynamically access and update contents, style and the structure of documents. It defines the way in which a document is accessed by also defining the logical structure of documents.
2. XHTML is a stricter and cleaner version of HTML. With normal html you can have certain tags that do not have a closing tag but with XHTML closing tags are enforced and results in a much cleaner and tidier document.
Longer Questions
1.
a) The line bellow is an XML declaration used for XHTML documents
<?xml version="1.0"?>
b) The line bellow indicates the DOCTYPE and states where to find the DTD file. This DOCTYPE is used to validate the document as correct XHTML.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
c) The line bellow specifies the xml namespace for a document, and is required in XHTML documents
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
2.The 10 lines on the next page are javascript code and the function of the code will in the end will output information obtained from the document using the “documentwrite()” function. The document write function is the equivalent of the “echo” function from the server side scripting language known as PHP in the sense that it is used to output information.
3.
The line “<-- and a line //-->”, is a comment.
Lecture Reflection-WEEK 15 - SAX
In the mid 1998 XML parser was developed which is a type of SAX. This was developed before the DOM was published by the W3C organisation.
The benefits that SAX parsers have over DOM-style parsers such as the quantity of memory that a SAX parser must use in order to function is typically much smaller than that of a DOM parser. The Document Object Model must be built in the computer’s memory before any data is extracted which might be slow if used with a large XML document. This could result in exceeding the computer’s memory limit causing errors such as system crash. Sax is an event driven parser and works in a more linear format and responds to commands as they come.
The following shows how SAX handles code
XML document: -
<?xml version="1.0"?>
<doc><para>Hello, world! </para></doc>
SAX will break the structure down into a series of linear events: -
1 start document
2 start element: doc
3 start element: para
4 characters: Hello, world!
5 end element: para
6 end element: doc
7 end document
Following methods required for the program to use the parser: -
1 characters( ) :Receives notification of the character data inside an element.
2 startElement( ) :Receives notification of the start of an element.
3 endElement( ) :Receives notification of the end of an element.
4 startDocument( ) :Receives notification of the start of a document.
5 endDocument( ) :Receives notification of the end of a document.
6 processingInstruction( ) :Receives notification of a processing instruction.
http://www.ronnysmarket.com/
http://www.ronnysmarket.com/catalog/main
No comments:
Post a Comment