# ==================================================================
# Relax NG Schema for XSPF Version 1
# 
# $Id$
# 
# This schema was written as a service for developers who want
# to validate the playlists generated by their applications.
# Nobody claims it is perfect, so if you find bugs please report
# them. In any case, the spec overrides this schema.
# 
# Further information about XSPF is available at http://www.xspf.org
# 
# 
# Copyright (c) 2005 Matthias Friedrich <matt@mafr.de>
# 
# The schema is released under the Creative Commons 
# Attribution-ShareAlike 2.5 license.
# 
# http://creativecommons.org/licenses/by-sa/2.5/
# 
# 
# ChangeLog:
#  * 2008-07-26: Support for xml:base attribute
#                Sebastian Pipping <webmaster@hartwork.org>
# 
#  * 2007-02-16: Trang-friendly transformation of def_anything
#                Sebastian Pipping <webmaster@hartwork.org>
# 
#  * 2007-02-16: Interleave wrap for track and playlist
#                to allow arbitrary element order
#                Sebastian Pipping <webmaster@hartwork.org>
# 
#  * 2007-01-07: The info element's content has been changed from
#                type "text" to "anyURI", as per spec.
#                Matthias Friedrich <matt@mafr.de>
# 
#  * 2006-09-25: Fixed an error: the "attribution" element now allows
#                "identifier" child element elements, too.
#                Matthias Friedrich <matt@mafr.de>
# ==================================================================

default namespace = "http://xspf.org/ns/0/"

start = def_playlist-element
def_playlist-element =
  element playlist {
    attribute version {
      xsd:string { pattern = "1" }
    },
    attribute xml:base {
      xsd:anyURI
    }?,
    (element title { text }?
     & element creator { text }?
     & element annotation { text }?
     & element info { xsd:anyURI }?
     & element location { xsd:anyURI }?
     & element identifier { xsd:anyURI }?
     & element image { xsd:anyURI }?
     & element date { xsd:dateTime }?
     & element license { xsd:anyURI }?
     & def_attribution-element?
     & def_link-element*
     & def_meta-element*
     & def_extension-element*
     & element trackList { def_track-element* })
  }
def_attribution-element =
  element attribution {
    (element identifier { xsd:anyURI }
     | element location { xsd:anyURI })*
  }
def_link-element =
  element link {
    attribute rel { xsd:anyURI },
    xsd:anyURI
  }
def_meta-element =
  element meta {
    attribute rel { xsd:anyURI },
    text
  }
def_extension-element =
  element extension {
    attribute application { xsd:anyURI },
    (element * { def_anything }
     | text)*
  }
def_anything =
  element * { def_anything }*
  & attribute * { text }*
  & text*
def_track-element =
  element track {
    element location { xsd:anyURI }*
    & element identifier { xsd:anyURI }*
    & element title { text }?
    & element creator { text }?
    & element annotation { text }?
    & element info { xsd:anyURI }?
    & element image { xsd:anyURI }?
    & element album { text }?
    & element trackNum { xsd:nonNegativeInteger }?
    & element duration { xsd:nonNegativeInteger }?
    & def_link-element*
    & def_meta-element*
    & def_extension-element*
  }