Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

COMPSCI 752

Big Data Management

Strategic Exercise 1

XML

For some of these exercises you may need to do a little bit of research beyond the lecture slides to find answers.

Exercise 1 - XML purpose.

a. Explain the difference in purpose between the HTML and XML languages.

b. Briefly explain two main application  areas of XML.

c. Name four reasons for the success  of XML.

Exercise 2 - XML syntax.

a. Name two basic rules that well-formed XML  documents  must satisfy.

b. For each rule, give a simple example that violates this rule.

Exercise 3 - XML documents.

Consider the following XML document.

〈?xml version=“1.0” encoding=“ISO-8859-1” ?)

〈?xml-stylesheet href=“headlines.css” type=“text/css” ?)

〈invoice)

〈product)Lenovo X201〈/product)

〈customer)Jack Ryan〈/customer)

〈amount)NZ$1822〈/amount)

〈data)30-03-2011〈/date)

〈/invoice)

a. Indicate the major parts  of the XML document above.

Exercise 4 - DTD purpose.

a. Name two ways in which Document Type Definitions (DTDs) can assist XML parsers.

Exercise 5 - DTD modeling.

Consider the following XML document.

〈Movies)

〈Movie Year-released=“2009”)

〈Title)The girl with the dragon tattoo〈/Title)

〈Director)Niels Arden Oplev〈/Director)

〈Actors)

〈Actor)Noomi Rapace〈/Actor)

〈/Actors)

〈/Movie)

〈Movie Year-released=“2009”)

〈Title)The girl who played with fire〈/Title)

〈Writer)Jonas Frykberg〈/Writer)

〈Writer)Stieg Larsson〈/Writer)

〈Actors)

〈Actor)Noomi Rapace〈/Actor)

〈Actor)Michael Nyqvist〈/Actor)

〈/Actors)

〈/Movie)

〈/Movies)

a. Write down a Document  Type  Definition  (DTD) which validates the XML document.

b. Considering that DTDs are meant to model typical XML documents associated with the given domain, what changes would you make to your original DTD to validate typical XML documents that occur the movie domain. Argue why you make certain choices.

Exercise 6 - DTD validation.

〈enrolment)

〈student studentID=“s01”/)

〈class studentIDrefs=“s01 s02”) title)ELCM XML〈/title)

〈/class)

〈/enrolment)

〈!ELEMENT enrolment (student+, class))

〈!ELEMENT student EMPTY)

〈!ATTLIST student studentID ID #REQUIRED) 〈!ELEMENT class (title))

〈!ATTLIST class studentIDrefs IDREFS #REQUIRED) 〈!ELEMENT title (#PCDATA))

a. Explain whether the XML document on the left conforms to the DTD on the right.

Exercise 7 - DTD for mixed content.

a. Write down a DTD  that specifies an element with mixed content.