<document>
  <header>
    <product>resin</product>
    <title>Resin web.xml Relax-NG Schema</title>
    <version>Resin 3.0</version>
    <description>
      <p>The formal definition for the Resin web.xml configuration.</p>
    </description>
  </header>

  <body>
    <summary/>

<s1 title="Relax-NG Schema">

<def title="com/caucho/server/webapp/resin-web-xml.rnc">
include "resin-web-xml-content.rnc"

start = m_web-app

m_web-app = r_web-app | j2ee_web-app | l_web-app
</def>

<def title="com/caucho/server/webapp/resin-web-xml-content.rnc">
default namespace r = "http://caucho.com/ns/resin"
namespace l = ""

namespace rcore = "http://caucho.com/ns/resin/core"

namespace xsi = "http://www.w3.org/2001/XMLSchema-instance"

include "../resin/env.rnc"
include "web-xml-content.rnc"

## l_web-app should probably be handled in web-xml.rnc as Servlet 2.3
l_web-app = element l:web-app { r_any-Group }

## r_boolean-Type = string
## r_int = string
## r_period = string
## r_jndi = string
## r_class-Type = string
## r_kbytes = string

r_access-log = element access-log {
  r_resin-type?

  &amp; r_log-Content

  &amp; (attribute format { string }
     | element format { string })?

  &amp; (attribute archive-format { string }
     | element archive-format { string })?

  &amp; r_init?
}

r_allow-servlet-el =
  attribute allow-servlet-el { r_boolean-Type }
  | element allow-servlet-el { r_boolean-Type }

r_auth-constraint = element auth-constraint {
  r_description*,

  r_role-name*
}

r_cache-mapping = element cache-mapping {
  r_url-pattern

  &amp; (attribute expires { r_period }
     | element expires { r_period })
}

r_constraint = element constraint {
  r_resin-type,

  r_any-Group
}

r_config-file =
  attribute config-file { string }
  | element config-file { string }

r_context-param = element context-param {
  r_init-param-Content
}

r_context-path =
  attribute context-path { string }
  | element context-path { string }

## marks the web-app as distributable
r_distributable =
  attribute distributable { string }
  | element distributable { string }

r_document-directory =
  attribute document-directory { r_path-Type }
  | element document-directory { r_path-Type }

r_ear-Content =
  r_class-loader?,

  (r_env-Content

   &amp; r_config-file*)

r_ear-default = element ear-default {
  r_ear-Content
}

r_ear-deploy = element ear-deploy {
  (attribute url-prefix { string }
   | element url-prefix { string })?

  &amp; r_path

  &amp; (attribute expand-directory { r_path-Type }
     | element expand-directory { r_path-Type })?

  &amp; (attribute archive-directory { r_path-Type }
     | element archive-directory { r_path-Type })?

  &amp; (attribute expand-path { r_path-Type }
     | element expand-path { r_path-Type })?

  &amp; r_lazy-init?

  &amp; r_ear-default?
}

r_error-page = element error-page {
  (attribute error-code { string }
   | element error-code { string }
   | attribute exception-type { string }
   | element exception-type { string })?,

  (attribute location { string }
   | element location { string })
}

r_filter = element filter {
   r_description-Group,

   (attribute filter-name { string }
    | element filter-name { string }),

   (attribute filter-class { r_class-Type }
    | element filter-class { r_class-Type }),

   (r_init | r_init-param*)
}

r_filter-mapping = element filter-mapping {
  (r_url-pattern

   | attribute url-regexp { string }
   | element url-regexp { string }
   | attribute servlet-name { string }
   | element servlet-name { string }),

  (attribute filter-name { string }
   | element filter-name { string }),

  (attribute dispatcher { string }
   | element dispatcher { string }*)
}

r_form-login-config = element form-login-config {
  (attribute form-login-page { string }
   | element form-login-page { string }),

  (attribute form-error-page { string }
   | element form-error-page { string }),

  (attribute internal-forward { r_boolean-Type }
   | element internal-forward { r_boolean-Type })?,

  (attribute form-uri-priority { r_boolean-Type }
   | element form-uri-priority { r_boolean-Type })?
}

r_jdbc-store = element jdbc-store {
  (attribute data-source { r_jndi }
   | element data-source { r_jndi })

  &amp; (attribute table-name { string }
     | element table-name { string })?

  &amp; (attribute blob-type { string }
     | element blob-type { string })?

  &amp; (attribute max-idle-time { r_period }
     | element max-idle-time { r_period })?
}

r_jsp = element jsp {
 (attribute auto-compile { r_boolean-Type }
  | element auto-compile { r_boolean-Type })?

 &amp; (attribute el-ignored { r_boolean-Type }
    | element el-ignored { r_boolean-Type })?

 &amp; (attribute fast-jstl { r_boolean-Type }
    | element fast-jstl { r_boolean-Type })?

 &amp; (attribute ide-hack { r_boolean-Type }
    | element ide-hack { r_boolean-Type })?

 &amp; (attribute ignore-el-exception { r_boolean-Type }
    | element ignore-el-exception { r_boolean-Type })?

 &amp; (attribute is-xml { r_boolean-Type }
    | element is-xml { r_boolean-Type })?

 &amp; (attribute jsp-max { r_int }
    | element jsp-max { r_int })?

 &amp; (attribute page-encoding { string }
    | element page-encoding { string })?

 &amp; (attribute precompile { r_boolean-Type }
    | element precompile { r_boolean-Type })?

 &amp; (attribute recompile-on-error { r_boolean-Type }
    | element recompile-on-error { r_boolean-Type })?

 &amp; (attribute recycle-tags { r_boolean-Type }
    | element recycle-tags { r_boolean-Type })?

 &amp; (attribute require-source { r_boolean-Type }
    | element require-source { r_boolean-Type })?

 &amp; (attribute scripting-invalid { r_boolean-Type }
    | element scripting-invalid { r_boolean-Type })?

 &amp; (attribute session { r_boolean-Type }
    | element session { r_boolean-Type })?

 &amp; (attribute tld-dir { r_boolean-Type }
    | element tld-dir { r_boolean-Type })?

 &amp; (attribute velocity-enabled { r_boolean-Type }
    | element velocity-enabled { r_boolean-Type })?
}

r_jsp-config = element jsp-config {
  attribute id { string }?,

  r_taglib*,

  r_jsp-property-group*
}

r_jsp-property-group = element jsp-property-group {
  attribute id { string }?,

  r_description-Group,

  r_url-pattern*,

  element el-ignored { j2ee_boolean }?,

  element page-encoding { j2ee_string }?,

  element scripting-invalid { j2ee_boolean }?,

  element is-xml { j2ee_boolean }?,

  element include-prelude { j2ee_path }*,

  element include-coda { j2ee_path }*
}

r_lazy-init =
  attribute lazy-init { r_boolean-Type }
  | element lazy-init { r_boolean-Type }

r_listener = element listener {
  r_description-Group,

  (attribute listener-class { string }
   | element listener-class { string }),

  r_init?
}

r_login-config = element login-config {
  r_type?,

  (attribute auth-method { string }
   | element auth-method { string })?,

  (attribute realm-name { string }
   | element realm-name { string })?,

  r_form-login-config?,

  (attribute authenticator { r_jndi }
   | element authenticator { r_jndi })?,

  r_init?
}

r_http-method-Values =
    "GET"
  | "POST"
  | "PUT"
  | "DELETE"
  | "HEAD"
  | "OPTIONS"
  | "TRACE"

r_http-method =
  attribute http-method { r_http-method-Values }
  | element http-method { r_http-method-Values }

r_ip-constraint =
  (attribute ip-constraint { string }
   | element ip-constraint { string })*

  | element ip-constraint { 
      ((element allow { string })*
       &amp; (element deny { string })*)*
  }

r_mime-mapping = element mime-mapping {
  (attribute extension { string }
   | element extension { string }),

  (attribute mime-type { string }
   | element mime-type { string })
}

r_multipart-form = element multipart-form {
  (attribute enable { r_boolean-Type }
   | element upload-max { r_boolean-Type })?

  &amp; (attribute upload-max { r_kbytes }
     | element upload-max { r_kbytes })?
}

## this doesn't exist in servlet spec?
r_path-mapping = element path-mapping {
  (r_url-pattern

   | attribute url-regexp { string }
   | element url-regexp { string })

  &amp; (attribute real-path { r_path-Type }
     | element real-path { r_path-Type })
}

r_persistent_store =
  attribute persistent-store { string }
  | element persistent-store { string }

r_redeploy-mode =
  attribute redeploy-mode { string }
  | element redeploy-mode { string }

r_run-at =
   attribute run-at { string }
   | element run-at {
      string
      | (attribute period { string }
         | element period { string })
   }

r_secure =
  attribute secure { r_boolean-Type }
  | element secure { r_boolean-Type }

r_security-constraint =
  element security-constraint {
    (r_display-name?,

     r_web-resource-collection*,

     (r_auth-constraint*

      &amp; r_user-data-constraint*

      &amp; r_ip-constraint*

      &amp; r_constraint*))

    | (r_url-pattern, r_role-name*)
  }

r_servlet = element servlet {
  r_description-Group,

  r_servlet-name,

  (attribute servlet-class { string }
   | element servlet-class { string }
   | attribute jsp-file { string }
   | element jsp-file { string }),

  r_servlet-Content
}

r_servlet-Content =
  ((r_init | r_init-param*)?,

   (attribute load-on-startup { string }
    | element load-on-startup { string })?,

   element run-as { string }?,

   r_security-role-ref*,

   r_run-at?)

r_servlet-mapping = element servlet-mapping {
  (r_url-pattern | r_url-regexp),

  (r_servlet-name 

  | (r_servlet-name?,

     (attribute servlet-class { string }
      | element servlet-class { string }
      | attribute jsp-file { string }
      | element jsp-file { string }),

      r_servlet-Content))

}

r_servlet-regexp = element servlet-regexp {
  r_url-regexp,

  r_servlet-name?,

  ((attribute servlet-class { string }
    | element servlet-class { string }
    | attribute jsp-file { string }
    | element jsp-file { string }),

   r_servlet-Content)?
}

r_servlet-name =
  attribute servlet-name { string }
  | element servlet-name { string }

r_session-config = element session-config {
  (attribute always-load-session { r_boolean-Type }
   | element always-load-session { r_boolean-Type })?

  &amp; (attribute always-save-session { r_boolean-Type }
     | element always-save-session { r_boolean-Type })?

  &amp; (attribute cookie-domain { string }
     | element cookie-domain { string })?

  &amp; (attribute cookie-length { r_int }
     | element cookie-length { r_int })?

  &amp; (attribute cookie-max-age { r_period }
     | element cookie-max-age { r_period })?

  &amp; (attribute cookie-secure { r_boolean-Type }
     | element cookie-secure { r_boolean-Type })?

  &amp; (attribute cookie-version { r_int }
     | element cookie-version { r_int })?

  &amp; (attribute cookie-port { string }
     | element cookie-port { string })?

  &amp; (attribute enable-cookies { r_boolean-Type }
     | element enable-cookies { r_boolean-Type })?

  &amp; (attribute enable-url-rewriting { r_boolean-Type }
     | element enable-url-rewriting { r_boolean-Type })?

  &amp; (attribute ignore-serialization-errors { r_boolean-Type }
     | element ignore-serialization-errors { r_boolean-Type })?

  &amp; (attribute invalidate-after-listener { r_boolean-Type }
     | element invalidate-after-listener { r_boolean-Type })?

  &amp; (attribute persistent-path { r_path-Type }
     | element persistent-path { r_path-Type })?

  &amp; (attribute reuse-session-id { r_boolean-Type }
     | element reuse-session-id { r_boolean-Type })?

  &amp; (attribute save-on-shutdown { r_boolean-Type }
     | element save-on-shutdown { r_boolean-Type })?

  &amp; (attribute save-only-on-shutdown { r_boolean-Type }
     | element save-only-on-shutdown { r_boolean-Type })?

  &amp; (attribute session-max { r_int }
     | element session-max { r_int })?

  &amp; (attribute session-timeout { r_int }
     | element session-timeout { r_int })?

  &amp; (attribute use-persistent-store { r_boolean-Type }
     | element use-persistent-store { r_boolean-Type })?

  &amp; (attribute cluster-store { r_boolean-Type }
     | element cluster-store { empty })?

  &amp; (attribute file-store { string }
     | element file-store { string })?
}

r_shutdown-wait-max =
  attribute shutdown-wait-max { r_period }
  | element shutdown-wait-max { r_period }

r_startup-mode =
  attribute startup-mode { string }
  | element startup-mode { string }

r_strict-mapping =
  attribute strict-mapping { r_boolean-Type }
  | element strict-mapping { r_boolean-Type }

r_taglib = element taglib {
  (attribute taglib-uri { string }
   | element taglib-uri { string }),

  (attribute taglib-location { string }
   | element taglib-location { string })
}

r_transport-guarantee =
  attribute transport-guarantee { r_transport-guarantee-Values }
  | element transport-guarantee { r_transport-guarantee-Values }

r_transport-guarantee-Values =
  "NONE"
  | "INTEGRAL"
  | "CONFIDENTIAL"

r_url-pattern =
  attribute url-pattern { string }
  | element url-pattern { string }

r_url-regexp = 
  attribute url-regexp { string }
  | element url-regexp { string }

r_user-data-constraint = element user-data-constraint {
  r_description*,

  r_transport-guarantee
}

r_web-app-default = element web-app-default {
  r_web-app-Content
}

r_web-app-deploy = element web-app-deploy {
  (attribute url-prefix { string }
   | element url-prefix { string })?

  &amp; r_path

  &amp; (attribute archive-directory { r_path-Type }
     | element archive-directory { r_path-Type })?

  &amp; (attribute expand-directory { r_path-Type }
     | element expand-directory { r_path-Type })?

  &amp; (attribute expand-path { r_path-Type }
     | element expand-path { r_path-Type })?

  &amp; r_lazy-init?

  &amp; r_web-app-default*

  &amp; element web-app {
      r_context-path?,

      r_document-directory,

      r_web-app-Content
    }*
}

## basic allowed values for the web-app
r_web-app-Basis =
  r_env-Basis

  &amp; r_class-loader-Group

  &amp; r_access-log*

  &amp; r_allow-servlet-el*

  &amp; r_cache-mapping*

  &amp; r_context-param*

  &amp; r_display-name*

  &amp; r_distributable?

  &amp; r_ear-deploy*

  &amp; r_ejb-local-ref*

  &amp; r_ejb-ref*

  &amp; r_error-page*

  &amp; r_filter*

  &amp; r_filter-mapping*

  &amp; (attribute inherit-session { r_boolean-Type }
     | element inherit-session { r_boolean-Type })?

  &amp; r_jsp?

  &amp; r_jsp-config*

  &amp; r_lazy-init*

  &amp; r_listener*

  &amp; r_login-config?

  &amp; r_message-destination*

  &amp; r_mime-mapping*

  &amp; r_multipart-form*

  &amp; r_resource-env-ref*

  &amp; r_secure?

  &amp; r_security-constraint*

  &amp; r_security-role*

  &amp; r_servlet*

  &amp; r_servlet-mapping*

  &amp; r_servlet-regexp*

  &amp; r_session-config*

  &amp; r_shutdown-wait-max?

  &amp; r_strict-mapping?

  &amp; r_taglib*

  &amp; r_path-mapping*

  &amp; rc_web-app*

  &amp; r_web-app-deploy*

  &amp; r_welcome-file-list?

## web-app allowed tags, including flow control
r_web-app-Flow =
  r_web-app-Basis

  &amp; element rcore:env { r_class-loader-Group, r_web-app-Flow }*

  &amp; element rcore:if { rcore_if-Args, r_web-app-Flow }*

  &amp; element rcore:choose {
      element rcore:when { rcore_when-Args, r_web-app-Flow }+,
      element rcore:otherwise { r_web-app-Flow }?
    }*

r_web-app-Content =
  (r_web-app-Flow

   &amp; r_config-file*)

r_web-app = element web-app {
  attribute version { string }?,
  attribute xsi:schemaLocation { string }?,

  r_web-app-Content
}

rc_web-app = element web-app {
  (attribute id { string }
  | attribute url-prefix { string } | element url-prefix { string }
  | attribute url-regexp { string } | element url-regexp { string }),

  (r_context-path?

  &amp; r_document-directory?

  &amp; r_startup-mode?

  &amp; r_redeploy-mode?),

  r_web-app-Content
}

r_web-resource-collection = element web-resource-collection {
  (attribute web-resource-name { string }
   | element web-resource-name { string })?,

  r_description*,

  r_url-pattern*,

  r_http-method*
}


r_welcome-file-list = element welcome-file-list {
  string |

  element welcome-file { string }*
}
</def>
</s1>

  </body>
</document>