<?xml version="1.0" encoding="UTF-8"?>
<!-- <!DOCTYPE xs:schema PUBLIC
        "-//W3C//DTD XMLSCHEMA 200102//EN"
        "http://www.w3.org/2001/XMLSchema.dtd">  -->
<!--*MT*
    
    MediaTomb - http://www.mediatomb.cc/
    
    config.xsd - this file is part of MediaTomb.
    
    Copyright (C) 2005 Gena Batyan <bgeradz@mediatomb.cc>,
                       Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
    
    Copyright (C) 2006-2010 Gena Batyan <bgeradz@mediatomb.cc>,
                            Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>,
                            Leonhard Wimmer <leo@mediatomb.cc>
    
    MediaTomb is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 2
    as published by the Free Software Foundation.
    
    MediaTomb is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    version 2 along with MediaTomb; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
    
    $Id$
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://mediatomb.cc/config/1" xmlns="http://mediatomb.cc/config/1">

    <xs:simpleType name="boolean">
        <xs:restriction base="xs:string">
            <xs:enumeration value="yes"/>
            <xs:enumeration value="no"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:element name="config">
        <xs:complexType>
            <xs:all>
                <xs:element ref="server"/>
                <xs:element ref="clients" minOccurs="0"/>
                <xs:element ref="import" minOccurs="0"/>
                <xs:element ref="transcoding" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="version" type="xs:positiveInteger" fixed="1"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="server">
        <xs:complexType>
            <xs:all>
                <xs:element ref="ui" minOccurs="0"/>
                <xs:element ref="port" minOccurs="0"/>
                <xs:element ref="name" minOccurs="0"/>
                
                <!-- required, but autogenerated by MediaTomb at startup -->
                <xs:element ref="udn" minOccurs="0"/>

                <xs:element ref="home"/>
                <xs:element ref="webroot"/>
                <xs:element ref="storage"/>
                <xs:element ref="ip" minOccurs="0"/>
                <xs:element ref="interface" minOccurs="0"/>
                <xs:element ref="modelName" minOccurs="0"/>
                <xs:element ref="modelNumber" minOccurs="0"/>
                <xs:element ref="bookmark" minOccurs="0"/>
                <xs:element ref="model" minOccurs="0"/>
                <xs:element ref="manufacturerURL" minOccurs="0"/>
                <xs:element ref="virtualURL" minOccurs="0"/>
                <xs:element ref="presentationURL" minOccurs="0"/>
                <xs:element ref="upnp-string-limit" minOccurs="0"/>
                <xs:element ref="alive" minOccurs="0"/>
                <xs:element ref="modelDescription" minOccurs="0"/>
                <xs:element ref="serialNumber" minOccurs="0"/>
                <xs:element ref="pc-directory" minOccurs="0"/>
                <xs:element ref="tmpdir" minOccurs="0"/>
                <xs:element ref="retries-on-timeout" minOccurs="0"/>
                <xs:element ref="upnp" minOccurs="0"/>
                <xs:element ref="containers" minOccurs="0"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="port" type="xs:nonNegativeInteger"/>

    <xs:element name="ip" type="xs:string"/>

    <xs:element name="interface" type="xs:string"/>

    <xs:element name="name" type="xs:string" default="MediaTomb"/>

    <xs:element name="modelName" type="xs:string" default="MediaTomb"/>

    <xs:element name="modelNumber" type="xs:string"/>

    <xs:element name="modelDescription" type="xs:string"/>

    <xs:element name="manufacturerURL" type="xs:string" default="http://mediatomb.cc/"/>

    <xs:element name="presentationURL" default="/">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="append-to" default="none">
                        <xs:simpleType>
                            <xs:restriction base="xs:string">
                                <xs:enumeration value="none"/>
                                <xs:enumeration value="ip"/>
                                <xs:enumeration value="port"/>
                            </xs:restriction>
                        </xs:simpleType>
                    </xs:attribute>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="udn" type="xs:string"/>

    <xs:element name="home" type="xs:string" default="~/.mediatomb"/>

    <xs:element name="webroot" type="xs:string"/>

    <xs:element name="alive" type="xs:positiveInteger" default="180"/>

    <xs:element name="serialNumber" type="xs:string"/>

    <xs:element name="add">
        <xs:complexType>
            <xs:attribute name="header" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="upnp-string-limit" type="xs:integer"/>

    <xs:element name="bookmark" type="xs:string"/>

    <xs:element name="model" type="xs:string"/>

    <xs:element name="pc-directory">
        <xs:complexType>
            <xs:attribute name="upnp-hide" type="boolean" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="tmpdir" type="xs:string"/>

    <xs:element name="retries-on-timeout" type="xs:integer"/>

    <xs:element name="ui">
        <xs:complexType>
            <xs:all>
                <xs:element ref="accounts" minOccurs="0"/>
                <xs:element ref="items-per-page" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="poll-interval" type="xs:positiveInteger" default="2"/>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="poll-when-idle" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="accounts">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="account" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="session-timeout" type="xs:positiveInteger" default="30"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="account">
        <xs:complexType>
            <xs:attribute name="user" type="xs:string" use="required"/>
            <xs:attribute name="password" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="items-per-page">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="option" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="default" type="xs:positiveInteger" default="25"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="option" type="xs:positiveInteger"/>

    <xs:element name="containers">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="container" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="container">
        <xs:complexType>
            <xs:all>
                <xs:element ref="filter" minOccurs="1" maxOccurs="1"/>
            </xs:all>
            <xs:attribute name="location" type="xs:string" use="required"/>
            <xs:attribute name="title" type="xs:string"/>
            <xs:attribute name="image" type="xs:string"/>
            <xs:attribute name="sort" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="filter" type="xs:string"/>

    <!--  Storage -->

    <xs:element name="storage">
        <xs:complexType>
            <xs:all>
                <xs:element ref="sqlite3" minOccurs="0"/>
                <xs:element ref="mysql" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="use-transactions" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="sqlite3">
        <xs:complexType>
            <xs:all>
                <xs:element ref="database-file" minOccurs="0"/>
                <xs:element ref="init-sql-file" minOccurs="0"/>
                <xs:element ref="synchronous" minOccurs="0"/>
                <xs:element ref="on-error" minOccurs="0"/>
                <xs:element ref="backup" minOccurs="0"/>
                <xs:element ref="upgrade-file" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="database-file" type="xs:string" default="mediatomb.db"/>

    <xs:element name="synchronous" default="off">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="off"/>
                <xs:enumeration value="normal"/>
                <xs:enumeration value="full"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>

    <xs:element name="on-error" default="restore">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                <xs:enumeration value="restore"/>
                <xs:enumeration value="fail"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
    <xs:element name="backup">
        <xs:complexType>
            <xs:attribute name="enabled" type="boolean" default="no"/>
            <xs:attribute name="interval" type="xs:positiveInteger" default="600"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mysql">
        <xs:complexType>
            <xs:all>
                <xs:element ref="host" minOccurs="0"/>
                <xs:element ref="port" minOccurs="0"/>
                <xs:element ref="username" minOccurs="0"/>
                <xs:element ref="password" minOccurs="0"/>
                <xs:element ref="database" minOccurs="0"/>
                <xs:element ref="init-sql-file" minOccurs="0"/>
                <xs:element ref="upgrade-file" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="host" type="xs:string" default="localhost"/>
    <xs:element name="username" type="xs:string" default="mediatomb"/>
    <xs:element name="password" type="xs:string"/>
    <xs:element name="database" type="xs:string" default="localhost"/>
    <xs:element name="upgrade-file" type="xs:string"/>

    <xs:element name="upnp">
        <xs:complexType>
            <xs:all>
                <xs:element ref="album-properties" minOccurs="0"/>
                <xs:element ref="artist-properties" minOccurs="0"/>
                <xs:element ref="genre-properties" minOccurs="0"/>
                <xs:element ref="playlist-properties" minOccurs="0"/>
                <xs:element ref="title-properties" minOccurs="0"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="album-properties">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="upnp-namespace" minOccurs="0"/>
                <xs:element ref="upnp-property" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="artist-properties">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="upnp-namespace" minOccurs="0"/>
                <xs:element ref="upnp-property" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="genre-properties">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="upnp-namespace" minOccurs="0"/>
                <xs:element ref="upnp-property" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="playlist-properties">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="upnp-namespace" minOccurs="0"/>
                <xs:element ref="upnp-property" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="title-properties">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="upnp-namespace" minOccurs="0"/>
                <xs:element ref="upnp-property" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="upnp-property">
        <xs:complexType>
            <xs:attribute name="upnp-tag" type="xs:string" use="required"/>
            <xs:attribute name="meta-data" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="upnp-namespace">
        <xs:complexType>
            <xs:attribute name="xmlns" type="xs:string" use="required"/>
            <xs:attribute name="uri" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <!-- Clients -->

    <xs:element name="clients">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="client" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="client">
        <xs:complexType>
            <xs:attribute name="ip" type="xs:string" minOccurs="0"/>
            <xs:attribute name="userAgent" type="xs:string" minOccurs="0"/>
            <xs:attribute name="flags" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <!-- Import -->

    <xs:element name="import">
        <xs:complexType>
            <xs:all>
                <xs:element ref="scripting" minOccurs="0"/>
                <xs:element ref="mappings" minOccurs="0"/>
                <xs:element ref="filesystem-charset" minOccurs="0"/>
                <xs:element ref="metadata-charset" minOccurs="0"/>
                <xs:element ref="playlist-charset" minOccurs="0"/>
                <xs:element ref="autoscan" minOccurs="0"/>
                <xs:element ref="system-directories" minOccurs="0"/>
                <xs:element ref="visible-directories" minOccurs="0"/>
                <xs:element ref="directories" minOccurs="0"/>
                <xs:element ref="layout" minOccurs="0"/>
                <xs:element ref="resources" minOccurs="0"/>
                <xs:element ref="library-options" minOccurs="0"/>
                <xs:element ref="magic-file" minOccurs="0"/>
                <xs:element ref="online-content" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="hidden-files" type="boolean" default="no"/>
            <xs:attribute name="follow-symlinks" type="boolean" default="yes"/>
            <xs:attribute name="readable-names" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="scripting">
        <xs:complexType>
            <xs:all>
                <xs:element ref="common-script" minOccurs="0"/>
                <xs:element ref="custom-script" minOccurs="0"/>
                <xs:element ref="playlist-script" minOccurs="0"/>
                <xs:element ref="virtual-layout" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="script-charset" type="xs:string" default="UTF-8"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="common-script" type="xs:string"/>
    <xs:element name="custom-script" type="xs:string"/>

    <xs:element name="playlist-script">
        <xs:complexType>
            <xs:simpleContent>
                <xs:extension base="xs:string">
                    <xs:attribute name="create-link" type="boolean" default="yes"/>
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:element>

    <xs:element name="virtual-layout">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="import-script" minOccurs="0"/>
                <xs:element ref="script-options" minOccurs="0"/>
                <xs:element ref="genre-map" minOccurs="0"/>
                <xs:element ref="structured-layout " minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="type" default="builtin">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="builtin"/>
                        <xs:enumeration value="js"/>
                        <xs:enumeration value="disabled"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
            <xs:attribute name="audio-layout" type="string"/>
            <xs:attribute name="video-layout" type="string"/>
            <xs:attribute name="image-layout" type="string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="import-script" type="xs:string"/>

    <xs:element name="system-directories">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-path" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="visible-directories">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-path" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-path">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="script-options">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="script-option" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="script-option">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="value" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="genre-map">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="genre" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="genre">
        <xs:complexType>
            <xs:attribute name="from" type="xs:string" use="required"/>
            <xs:attribute name="to" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="structured-layout">
        <xs:complexType>
            <xs:attribute name="skip-chars" type="xs:string"/>
            <xs:attribute name="album-box" type="xs:string" default="6"/>
            <xs:attribute name="artist-box" type="xs:string" default="9"/>
            <xs:attribute name="genre-box" type="xs:string" default="6"/>
            <xs:attribute name="track-box" type="xs:string" default="6"/>
            <xs:attribute name="div-char" type="xs:string" default="-"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="filesystem-charset" type="xs:string"/>

    <xs:element name="metadata-charset" type="xs:string"/>

    <xs:element name="playlist-charset" type="xs:string"/>

    <xs:element name="magic-file" type="xs:string"/>

    <xs:element name="autoscan">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="directory" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="directory">
        <xs:complexType>
            <xs:attribute name="location" type="xs:string" use="required"/>
            
            <!-- required only for "timed" mode -->
            <xs:attribute name="interval" type="xs:string"/>

            <xs:attribute name="hidden-files" type="boolean"/>
            <xs:attribute name="recursive" type="boolean" use="required"/>
            <xs:attribute name="mode" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="timed"/>
                        <xs:enumeration value="inotify"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="directories">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="tweak" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="tweak">
        <xs:complexType>
            <xs:attribute name="location" type="xs:string" use="required"/>
            <xs:attribute name="inherit" type="boolean" use="required"/>
            <xs:attribute name="hidden-files"/>
            <xs:attribute name="recursive" type="boolean"/>
            <xs:attribute name="case-sensitive" type="boolean"/>
            <xs:attribute name="fanart-file" type="xs:string"/>
            <xs:attribute name="subtitle-file" type="xs:string"/>
            <xs:attribute name="resource-file" type="xs:string"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="layout">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="path" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="enabled" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="path">
        <xs:complexType>
            <xs:attribute name="from" type="xs:string" use="required"/>
            <xs:attribute name="to" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mappings">
        <xs:complexType>
            <xs:all>
                <xs:element ref="extension-mimetype" minOccurs="0"/>
                <xs:element ref="mimetype-contenttype" minOccurs="0"/>
                <xs:element ref="mimetype-upnpclass" minOccurs="0"/>
                <xs:element ref="contenttype-dlnaprofile" minOccurs="0"/>
            </xs:all>
        </xs:complexType>
    </xs:element>

    <xs:element name="extension-mimetype">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="ignore-unknown" type="boolean" default="no"/>
            <xs:attribute name="case-sensitive" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype-contenttype">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="treat" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="ignore-unknown" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="treat">
        <xs:complexType>
            <xs:attribute name="mimetype" type="xs:string" use="required"/>
            <xs:attribute name="as" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype-upnpclass">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="map">
        <xs:complexType>
            <xs:attribute name="from" type="xs:string" use="required"/>
            <xs:attribute name="to" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="contenttype-dlnaprofile">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="map" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="resources">
        <xs:complexType>
            <xs:all>
                <xs:element ref="order" minOccurs="0"/>
                <xs:element ref="container" minOccurs="0"/>
                <xs:element ref="fanart" minOccurs="0"/>
                <xs:element ref="subtitle" minOccurs="0"/>
                <xs:element ref="resource" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="case-sensitive" type="boolean" default="yes"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="order">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="handler" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="container">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0"/>
                <xs:element ref="add-dir" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="parentCount"/>
            <xs:attribute name="minDepth"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="fanart">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0"/>
                <xs:element ref="add-dir" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="subtitle">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0"/>
                <xs:element ref="add-dir" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="resource">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-file" minOccurs="0"/>
                <xs:element ref="add-dir" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="handler">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-file">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-dir">
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="ext" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="library-options">
        <xs:complexType>
            <xs:all>
                <xs:element ref="libexif" minOccurs="0"/>
                <xs:element ref="exiv2" minOccurs="0"/>
                <xs:element ref="ffmpeg" minOccurs="0"/>
                <xs:element ref="id3" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="multi-value-separator" type="xs:string" minOccurs="0" default="; "/>
            <xs:attribute name="legacy-value-separator" type="xs:string" minOccurs="0"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="libexif">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
       <xs:attribute name="charset" type="xs:string" minOccurs="0"/>
    </xs:element>

    <xs:element name="exiv2">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
       <xs:attribute name="charset" type="xs:string" minOccurs="0"/>
    </xs:element>

    <xs:element name="ffmpeg">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
       <xs:attribute name="charset" type="xs:string" minOccurs="0"/>
    </xs:element>

    <xs:element name="id3">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="auxdata" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
       <xs:attribute name="charset" type="xs:string" minOccurs="0"/>
    </xs:element>

    <xs:element name="auxdata">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="add-data" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="add-data">
        <xs:complexType>
            <xs:attribute name="tag" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <!-- Transcoding -->

    <xs:element name="transcoding">
        <xs:complexType>
            <xs:all>
                <xs:element ref="mimetype-profile-mappings" minOccurs="0"/>
                <xs:element ref="profiles" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="enabled" type="boolean" default="yes"/>
            <xs:attribute name="fetch-buffer-size" type="xs:positiveInteger" default="262144"/>
            <xs:attribute name="fetch-buffer-fill-size" type="xs:nonNegativeInteger" default="0"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype-profile-mappings">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="transcode" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="allow-unused" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="transcode">
        <xs:complexType>
            <xs:attribute name="mimetype" type="xs:string" use="required"/>
            <xs:attribute name="using" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="profiles">
        <xs:complexType>
            <xs:sequence>
                <xs:element ref="profile" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="allow-unused" type="boolean" default="no"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="profile">
        <xs:complexType>
            <xs:all>
                <xs:element ref="mimetype"/>
                <xs:element ref="accept-url" minOccurs="0"/>
                <xs:element ref="first-resource" minOccurs="0"/>
                <xs:element ref="hide-original-resource" minOccurs="0"/>
                <xs:element ref="accept-ogg-theora" minOccurs="0"/>
                <xs:element ref="agent"/>
                <xs:element ref="buffer"/>
                <xs:element ref="resolution" minOccurs="0"/>
                <xs:element ref="thumbnail" minOccurs="0"/>
            </xs:all>
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="client-flags" type="xs:string"/>
            <xs:attribute name="enabled" type="boolean" use="required"/>
            <xs:attribute name="type" use="required">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="external"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="mimetype" type="xs:string"/>

    <xs:element name="accept-url" type="boolean" default="yes"/>

    <xs:element name="first-resource" type="boolean" default="no"/>

    <xs:element name="hide-original-resource" type="boolean" default="no"/>

    <xs:element name="accept-ogg-theora" type="boolean" default="no"/>

    <xs:element name="agent">
        <xs:complexType>
            <xs:attribute name="command" type="xs:string" use="required"/>
            <xs:attribute name="arguments" type="xs:string" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="buffer">
        <xs:complexType>
            <xs:attribute name="size" type="xs:positiveInteger" use="required"/>
            <xs:attribute name="chunk-size" type="xs:positiveInteger" use="required"/>
            <xs:attribute name="fill-size" type="xs:nonNegativeInteger" use="required"/>
        </xs:complexType>
    </xs:element>

    <xs:element name="resolution" type="xs:string"/>
    
    <xs:element name="thumbnail" type="boolean"/>

    <!-- online-content -->

    <xs:element name="online-content">
        <xs:complexType>
            <xs:attribute name="fetch-buffer-size" type="xs:positiveInteger" default="262144"/>
            <xs:attribute name="fetch-buffer-fill-size" type="xs:nonNegativeInteger" default="0"/>
        </xs:complexType>
    </xs:element>
</xs:schema>
