Timers, XML




CS174

Chris Pollett

Apr 13, 2016

Outline

Dynamic Content

Timers

Let's Build Something

Create a small HTML page with an h1 header that says: "Enter Your Name To Win". Beneath this it has a text field with label Name and an Enter button. In a div field below this is a count down clock that is updated every five seconds. Initially, it says, "30 Seconds Left!" If the Enter button is clicked before the 30 seconds is up and the Name field is not empty, the div field says, "Congratulations, you won!" If the Enter button is clicked but no data is in the name field, an alert appears saying, "Please Enter Your Name". Finally, if the 30 seconds expires, the div field is replaced with "Times up, you missed a great opportunity!"

Post your code to the April 11 Discussion Thread.

Introduction to XML

The Syntax of XML

XML Document Structure and Entities

Document Type Definitions

<!ELEMENT ..>

<!ATTLIST ..>

<!ENTITY ..>

Example DTD

<?xml version = "1.0" encoding ="utf-8" ?>
<!-- planes_for_sale.dtd  -->
<!ELEMENT planes_for_sale (ad+) >
<!ELEMENT ad (year, make, model, color, price?, seller) >
<!ELEMENT year (#PCDATA)>
<!ELEMENT make (#PCDATA)>
<!ELEMENT model (#PCDATA)>
<!ELEMENT color (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT seller (#PCDATA)>
<!ATTLIST seller license CDATA #REQUIRED >
<!ENTITY c "cessna" >

Internal versus External DTDs

Namespaces

XML Schemas

More on Schemas