Game Development Reference
In-Depth Information
12.5 Minimaxima: A Case Study
12.5.1 Background
When I began writing this chapter, I set a goal to provide a real case of XML data
binding in a game pipeline. There are quite a few applications that either use XML
natively or export to XML. We've already seen how Excel supports exporting to
XML. I looked at other products that might be useful in a game pipeline, such as
iMovie or Final Cut Pro. I also looked at data in abundance on the web, such as
Google's Keyhole Markup Language (KML) which is used for expressing geographic
data. In the end, I decided on a common application known to many: Apple's
iTunes. The iTunes Library metadata is stored in an XML format. Unfortunately,
this format isn't readily usable by .NET serialization. Listing 12.15 shows a snippet
of what it looks like.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
" http: // www . apple . com / DTDs / PropertyList -1.0. dtd " >
<plist version="1.0">
<dict>
<key>Major Version</key><integer>1</integer>
<key>Minor Version</key><integer>1</integer>
<key>Application Version</key><string>10.0.1</string>
<key>Features</key><integer>5</integer>
<key>Show Content Ratings</key><true/>
<key>Music Folder</key>
<string>file://localhost/Users/amir/Music
/iTunes/iTunes%20Media/</string>
<key>Library Persistent ID</key><string>42DAF318AC521979</string>
<key>Tracks</key>
<dict>
<key>79</key>
<dict>
<key>Track ID</key><integer>79</integer>
<key>Name</key><string>Air Swell Intro</string>
<key>Artist</key><string>Chiddy Bang</string>
<key>Album Artist</key><string>Chiddy Bang</string>
<key>Composer</key><string>Xaphoon Jones</string>
<key>Album</key><string>Air Swell</string>
<key>Genre</key><string>Hip Hop</string>
Listing 12.15. iTunes Library XML document (iTunesLibrary.xml).
As you can see, the dict , key ,and string elements are not ready to be con-
sumed by .NET XML serialization directly. However, this can be remedied with a
handy XSL document [Staken 03] (see Listing 12.16).
<xsl:stylesheet version="1.0"
xmlns:xsl= " http://www.w3.org/1999/XSL/Transform "
xsl:version="1.0">
Search WWH ::




Custom Search