Chapter 14

14.1

Which of the following are valid XML element names? (Select all that apply.)

a) yearBorn

b) year.Born

c) year Born Incorrect due to space.

d) year-Born1

e) 2_year_born Incorrect due to first character being a number.

f) _year_born_

14.2

State which of the following statement are true and which are false. If false, explain why.

a) XML is a technology for creating markup languages. True.

b) XML markup is delimited by forward and backward slashes (/ and \). False. In an XML document, markup text is delimited by tags enclosed in angle brackets (< and >) with a forward slash just after the < in the end tag.

c) All XML start tags must have corresponding end tags. True.

d) Parsers check an XML document's syntax. True.

e) XML does not support namespaces. False. XML does support namespaces.

f) When creating XML elements, documents authors must use the set of XML tags provided by the W3C. False. When creating tags, document authors can use any valid name but should avoid ones that begin with the reserved word "xml" in any format.

g) The pound character (#), dollar sign ($), ampersand (&) and angle brackets (< and >) are examples of XML reserved characters. False. XML reserved characters include the ampersand (&), the left angle bracket (<) and the right angle bracket (>), but not # and $.

h) XML is not case sensitive. False. XML is case sensitive.

i) XML Schemas are better than DTDs, because DTDs lack a way of indicating what specific type of data (e.g., numeric, text) an elemnt can contain and DTDs are not themselves XML documents. True.

j) DTDs are written using an XML vocabulary. False. DTDs use EBNF grammar, which is not XML syntax.

k) Schema is a technology for locating information in an XML document. False. XPath is a technology for locating information in an XML document. XML Schema provides a means for type checking XML documents and verifying their validity.

14.3

Fill in the blanks for each of the following:

a) Namespaces help prevent naming collisions.

b) Processing instructions embed application-specific information into an XML document.

c) MSXML is Microsoft's XML parser.

d) XSL element xsl:output writes a DOCTYPE to the result tree.

e) XML Schema documents have root element schema.

f) XSL element xsl:stylesheet is the root element in an XSL document.

g) XSL element xsl:for-each selects specific XML elements using repetition.

h) Nodes that contain other nodes are called parent nodes.

i) Nodes that are peers are called sibling nodes.

14.4

In Fig. 14.2, we subdivided the author element into mare detailed pieces. How might you subdivide the date element? Use the date May 5, 2005, as an example.

<date>

<month>May</month>

<day>5</day>

<year>2005</year>

</date>

14.5

Write a processing instruction that includes style sheet wap.xsl.

<?xsl:stylesheet type = "text/xsl" href = "wap.xsl"?>

14.6

Write an XPath expression that locates contact nodes in letter.xml (Fig. 14.4).

/letter/contact.

14.7

14.8

14.9

14.10

14.11

News:

Working on Chapter 18