iTunes Data Type Definition (DTD)

iTunes uses an XML file to keep your music library, playlists and podcasts organized.  When you add a song to a playlist, iTunes does not duplicate the mp3 file on your website – that would add unnecessary MBs, if not GBs, to the storage space on your computer.  Instead, an XML file is created to act like a map.

Since XML is so flexible, Apple had to be sure that this XML file, this map, stays within the proper bounds of the relevant information of your music library and the proper language of the iTunes software.  At the very top of the XML file there is a reference to this iTunes data type definition (DTD) file:

http://www.apple.com/DTDs/PropertyList-1.0.dtd

When you go to this URL, you will find a very simple data type definition file that looks like this:

<!ENTITY % plistObject "(array | data | date | dict | real | integer | string | true | false )" >
<!ELEMENT plist %plistObject;>
<!ATTLIST plist version CDATA "1.0" >

<!-- Collections -->
<!ELEMENT array (%plistObject;)*>
<!ELEMENT dict (key, %plistObject;)*>
<!ELEMENT key (#PCDATA)>

<!--- Primitive types -->
<!ELEMENT string (#PCDATA)>
<!ELEMENT data (#PCDATA)>
<!ELEMENT date (#PCDATA)>

<!-- Numerical primitives -->
<!ELEMENT true EMPTY>
<!ELEMENT false EMPTY>
<!ELEMENT real (#PCDATA)>
<!ELEMENT integer (#PCDATA)>

 

We will go through each one of these lines to describe what is happening.

1. First there is the Entity definition that begins with <!ENTITY % followed by the name of entity. Here the name is “plistObject.” It is then followed by the data types that are acceptable to iTunes.

<!ENTITY % plistObject "(array | data | date | dict | real | integer | string | true | false )" >

2. Next we have the Element definition that is referring to the name of the Entity definition and giving it the name “plist.”

<!ELEMENT plist %plistObject;>

3. Below this is the Attribute definition that refers to the name of the Attribute definition, stating that the data will follow the rules of CDATA (unparsed, as opposed to “PCDATA” which is parsed).

<!ATTLIST plist version CDATA "1.0" >

4. In the Collections area we then have 3 different types of Elements that relate to one another:

<!-- Collections -->

a. Each element will be an array

<!ELEMENT array (%plistObject;)*>

b. Each array will be made up of two sections, a key and the data object

<!ELEMENT dict (key, %plistObject;)*>

c. The key will be parsed data (PCDATA)

<!ELEMENT key (#PCDATA)>

5. Next, the DTD lists the primitive data types, declaring that string, data, and date types will all be parsed data:

<!ELEMENT string (#PCDATA)>
<!ELEMENT data (#PCDATA)>
<!ELEMENT date (#PCDATA)>

6. Finally, we know that the true and false elements are to be empty, and both real numbers (decimals) and integers should be parsed characters.


<!-- Numerical primitives -->
<!ELEMENT true EMPTY>
<!ELEMENT false EMPTY>
<!ELEMENT real (#PCDATA)>
<!ELEMENT integer (#PCDATA)>

Now when the iTunes XML playlist file is loaded on your computer, it will be certain to have only data that iTunes can use to function properly.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>