Whitespace, Document type definitions, Working with xml created in different applications – Apple Final Cut Pro 5 User Manual

Page 1517

Advertising
background image

166

Part II

Project Interchange

Whitespace

Whitespace in a document includes multiple spaces, tab characters, carriage returns,
newline characters, and so on. An XML parser reads and processes XML tags in a
document, but ignores extra whitespace. To an XML parser, there is no difference
between

<clip><name>Coffee house wide shot</name><reel>17</reel></clip>

and

<clip>

<name>Coffee house wide shot</name>
<reel>17</reel>

</clip>

Whitespace is permitted so you can make your XML file more readable without
affecting the fundamental structure or meaning.

Document Type Definitions

Before you can create an XML document, you need to define the rules of your
document: Which elements (tags) can exist, which elements contain other elements,
which elements are optional or required, what attributes does each element have, and
so on. You define the rules of an XML document in a Document Type Definition, or DTD.
Every markup language has a DTD, so that parsers know how to verify the structure of
documents. Without a DTD, it is impossible for the parser to validate an XML document.
Every XML document requires a DTD.

If you are working with a predefined language, such as HTML or the Final Cut Pro XML
Interchange Format, the DTD has already been created for you. All you need to do is
follow the rules of the DTD to create valid Final Cut Pro XML.

Working With XML Created in Different Applications

XML documents can be used to represent almost any kind of information. Unlike
languages such as HTML, XML has no predefined elements. XML is not one format, but
rather XML is used to create specific XML-based markup languages. Just because an
application supports XML does not mean that it can recognize any kind of XML
document. For example, a database application may use an XML format with elements
like <row>, <column>, and <subtotal>, while a graphics application might store
information in elements such as <layer>, <shape>, and <color>. Even though both
documents are XML, they are incompatible because their Document Type Definitions
are completely different.

Advertising