13.07.2015 Views

Beginning CSS: Cascading Style Sheets for Web Design, 2nd ...

Beginning CSS: Cascading Style Sheets for Web Design, 2nd ...

Beginning CSS: Cascading Style Sheets for Web Design, 2nd ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Part III: Advanced <strong>CSS</strong> and Alternative MediaXML is said to be well <strong>for</strong>med when the document contains an XML declaration — the in this example — and all tags have both an opening and closing tag, any attributesin the document are all enclosed in quotes, and only one root element exists. In this example, the rootelement is . I cover the XML declaration in more detail later in this chapter. As with XHTML,you can use the shortcut syntax to close a tag, as shown in the element in this example.The XML declaration is technically optional, but experts agree that it is consideredbest practice to include it. The reasoning behind this is outside of the scope of thisbook; just keep in mind that it’s better to have it.Next, an XML document can only contain one root element. The root element in this example is the element; in HTML and XHTML the root element is the element. There<strong>for</strong>e, the followingis not a valid XML document because it contains two root elements.Figure 14-2aIf an XML document is not well <strong>for</strong>med, the browser refuses to display it and instead displays someerror text indicating what went awry. This error text is depicted in Figure 14-2b.You can use this error text to correct the document, after which the browser displays the XML documenttree like that shown in Figure 14-1.Finally, XML is case-sensitive. So and are two different tags in XML.As you’ve just seen here, XML’s markup structure can describe the data it contains. This is a benefit ofXML, but not a requirement. In the following section, I discuss creating an XML schema that you can useto structure the data contained in an XML document.504

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!