Chapter 13 Review:
• What does XML stand for? What is it used for? (See pages 409 and 410.)
XML stands for eXtensible Markup Language and is used for sharing data between applications.
• What line does XML data begin with? (See page 412.)
The first line, called the prolog is where an XML doc starts with <?xml version = "version #" and option encoding = "encoding ie utf-8"?>
• What are the rules for XML tags? Is XML case-sensitive or case-insensitive? (See pages 412 and 413.)
XML tags are closed with the same name and case they were opened with. Thus, XML IS case sensitive. XML elements can be nested but not intertwined.
• What are the rules for attributes? (See page 415.)
XML attributes are unlimited per element- but must have a value.
• If an element does not require a closing tag, what can you do instead? (See page 415.)
Like the HTML img tag, xml tags can be close as follows <elementName attritubeName='value' />
• How do you associate a DTD with an XML document (there are two answers)? (See page 419.)
A Document Type Definition File (DTD), can be reference in a DOC type declaration just below the prolog, or linking to a separate DTD file. Thus: <! DOCTYPE rootelement [definition] > or <! DOCTYPE rootelement SYSTEM "/ path/ to/ filename.dtd" >.
• How do you define elements and attributes using DTD? (See pages 420 through 422.)
<! ELEMENT name TYPE>
• What are entities and why are they required in XML data? (See page 415.)
Entities are characters that cannot be used in XML data. Similar to the way HTML doesn't allow certain characters in URLs. The most common are ampersand & - entity is &. There are 5 main entities in xml, (copied from Wikipedia
|Name||Character||Unicode code point (decimal)||Standard||Description|
|quot||"||U+0022 (34)||XML 1.0||double quotation mark|
|amp||&||U+0026 (38)||XML 1.0||ampersand|
|apos||'||U+0027 (39)||XML 1.0||apostrophe (= apostrophe-quote)|
|lt||<||U+003C (60)||XML 1.0||less-than sign|
|gt||>||U+003E (62)||XML 1.0||greater-than sign|
• How does XSD differ from DTD? (See pages 425 through 427.)
XSD allows greater control of data type enforcement and rules for datatype occurencs.
• How do you associate an XSD with an XML document (again, two answers)? (See page 425.)
Either added to document via: < xs:schema xmlns:xs =" http:// www.w3. org/ 2001/ XMLSchema" > <!-- Schema Information Here --> </ xs:schema>
or included by file:
<? xml version =" 1.0" encoding =" utf-8"? > < store xmlns:xsi =" http:// www.w3. org/ 2001/ XMLSchema-instance" xsi:noNamespaceSchemaLocation =" somefile.xsd">
• What are the two types of XML parsers demonstrated in this chapter? How do they differ? (See page 432.)
The two types or parsers in PHP are Expat and SimpleXML. SimpleXML is the more modern and flexible one, and allows easier accees, display and control of XML data.
• What are RSS feeds? How are they created using PHP? (See page 447.)
RSS feeds are a simple XML schema that defines titles, content, that are easily interpreted and integrated with most browsers.