# Metaproxy XML config file schemas
#
#   Copyright (C) Index Data
#   See the LICENSE file for details.
#
#
# The RELAX NG Compact Syntax file 'metaproxy.rnc' is the master copy.
#
# See http://www.indexdata.com/metaproxy/doc/config-file-syntax-check.html
#
# The RELAX NG XML Syntax and XML Schema are generated using 'trang':
# trang metaproxy.rnc metaproxy.rng
# trang metaproxy.rnc metaproxy.xsd
# 
# Config file validation is done using 'xmllint':
# xmllint --noout --relaxng metaproxy.rng ../../etc/config1.xml
# xmllint --noout --schema metaproxy.xsd ../../etc/config1.xml
#
# For information on RELAX NG see http://relaxng.org/
# see also http://books.xmlschemata.org/relaxng/

namespace mp = "http://indexdata.com/metaproxy"

start |= metaproxy

include "filter_auth_simple.rnc"
include "filter_backend_test.rnc"
include "filter_bounce.rnc"
include "filter_cgi.rnc"
include "filter_cql_rpn.rnc"
include "filter_frontend_net.rnc"
include "filter_http_client.rnc"
include "filter_http_file.rnc"
include "filter_http_rewrite.rnc"
include "filter_http_rewrite1.rnc"
include "filter_limit.rnc"
include "filter_load_balance.rnc"
include "filter_log.rnc"
include "filter_multi.rnc"
include "filter_present_chunk.rnc"
include "filter_query_rewrite.rnc"
include "filter_record_transform.rnc"
include "filter_sd_remove.rnc"
include "filter_session_shared.rnc"
include "filter_sort.rnc"
include "filter_sru_z3950.rnc"
include "filter_virt_db.rnc"
include "filter_z3950_client.rnc"
include "filter_zoom.rnc"

any = (text | element * { attribute * { text }*, any })*

metaproxy =
  element mp:metaproxy {
    attribute version { "1.0" },
    element mp:dlpath { xsd:string }?,
    element mp:start {
            attribute route { xsd:NCName }
    },
    element mp:filters { filter+ }?,
    element mp:routes { route+ }
  }

route =
  element mp:route {
    attribute id { xsd:NCName },
    filters+
  }

filters =
  filter |
  element mp:filters {
    filters+
  }

filter =
  element mp:filter {
    filter_refid
    | filter_auth_simple
    | filter_backend_test
    | filter_bounce
    | filter_cgi
    | filter_cql_rpn
    | filter_frontend_net
    | filter_http_client
    | filter_http_file
    | filter_http_rewrite
    | filter_http_rewrite1
    | filter_limit
    | filter_load_balance
    | filter_log
    | filter_multi
    | filter_present_chunk
    | filter_query_rewrite
    | filter_record_transform
    | filter_sd_remove
    | filter_session_shared
    | filter_sort
    | filter_sru_z3950
    | filter_virt_db
    | filter_z3950_client
    | filter_zoom
  }

filter_refid = attribute refid { xsd:NCName }
