Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Beginner working around variables

From: Howard Brazee <howard@------.--->
To: NULL
Date: 8/3/2007 12:02:00 PM

On Fri, 3 Aug 2007 09:06:01 -0700, ML <ML@d...>
wrote:

>If you post a sample of your XML and expected results we can provide much 
>better help.

The XML was created by iTunes.   It probably isn't the easiest XML
file to learn with, but it is a useful one.

I copied 
C:\Documents and Settings\brazee\My Documents\My Music\iTunes\iTunes
Music Library.xml to "Copy of iTunes Music Library.xml", and edited it
down.

Someday I will want to include a way to get around the fact that I
added the stylesheet line by hand, as the original .xml file keeps
getting overwritten.

<?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">
<?xml-stylesheet href="myiTunes.xsl" type="text/xsl"?>
<plist version="1.0">

<dict>
  <key>Major Version</key><integer>1</integer>
  <key>Minor Version</key><integer>1</integer>
  <key>Application Version</key><string>7.3.1</string>
  <key>Features</key><integer>1</integer>
  <key>Show Content Ratings</key><true/>
  <key>Music
Folder</key><string>file://localhost/C:/Documents%20and%20Settings/brazee/My%20Documents/My%20Music/iTunes/iTunes%20Music/</string>
  <key>Library Persistent ID</key><string>24C6C8A6E577E13C</string>
  <key>Tracks</key>
    <dict>
      <key>1382</key>
      <dict>
        <key>Track ID</key><integer>1382</integer>
        <key>Name</key><string>Six Man Band</string>
        <key>Artist</key><string>The Association</string>
        <key>Composer</key><string>Terry Kirkman</string>
        <key>Album</key><string>The Association's Greatest
Hits</string>
        <key>Genre</key><string>Rock</string>
        <key>Kind</key><string>Apple Lossless audio file</string>
        <key>Size</key><integer>13495797</integer>
        <key>Total Time</key><integer>132800</integer>
        <key>Disc Number</key><integer>1</integer>
        <key>Disc Count</key><integer>1</integer>
        <key>Track Number</key><integer>13</integer>
        <key>Track Count</key><integer>13</integer>
        <key>Year</key><integer>1968</integer>
        <key>Date Modified</key><date>2007-07-31T12:54:42Z</date>
        <key>Date Added</key><date>2007-05-24T12:55:10Z</date>
        <key>Bit Rate</key><integer>812</integer>
        <key>Sample Rate</key><integer>44100</integer>
        <key>Play Count</key><integer>2</integer>
        <key>Play Date</key><integer>3263546735</integer>
        <key>Play Date UTC</key><date>2007-06-01T18:45:35Z</date>
        <key>Rating</key><integer>60</integer>
        <key>>Sort Album</key><string>Association's Greatest
Hits</string>
        <key>Sort Artist</key><string>Association</string>
        <key>Persistent ID</key><string>7F4C299F41BBC98E</string>
        <key>Track Type</key><string>File</string>

<key>Location</key><string>file://localhost/C:/Documents%20and%20Settings/brazee/My%20Documents/My%20Music/iTunes/iTunes%20Music/The%20Association/The%20Association's%20Greatest%20Hits/13%20Six%20Man%20Band.m4a</string>
        <key>File Folder Count</key><integer>4</integer>
        <key>Library Folder Count</key><integer>1</integer>
        </dict>
...

This record is duplicated for each song in iTunes, but when a field is
blank, the field doesn't exist.   So the 13th key might be Rating, and
might be something else.

There's another record after these that I haven't yet looked at:
  <key>Playlists</key>
    <array>
      <dict>
        <key>Name</key><string>Library</string>
        <key>Master</key><true/>
        <key>Playlist ID</key><integer>1849</integer>
        <key>Playlist Persistent
ID</key><string>24C6C8A6E577E13D</string>
        <key>Visible</key><false/>
        <key>All Items</key><true/>
        <key>Playlist Items</key>
        <array>
           <dict>
             <key>Track ID</key><integer>339</integer>
           </dict>
           <dict>
             <key>Track ID</key><integer>340</integer>
           </dict>
...

So far, I wrote an .XML that showed the header information.

My detail information will eventually be a table with:

Name   	Artist			Rating
Six Man Band	The Association	***

(Apparently it stores 5 stars as 100, 4 as 80, 3 as 60, 2 as 40, 1 as
20, and zero doesn't get stored).   

I'll suppose I'll want to sort this table.

While that output would be useful, my primary goal is to figure out
how to program .XML for such a complicated file in a clean,
maintainable manner.   So I will be commenting it with reasons for my
choices.

It would be interesting to find .XSL that others have created to
handle this .XML file, but I haven't come across any yet.

If you don't have iTunes, it's free, and you don't need to buy songs -
just load a CD into it, and you will have your own .XML file to play
with.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent