<!--
  Copyright 2006 - 2012 Hannes Holtzhausen

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->

<!--
 $Id: web_config_1_0.dtd,v 1.11 2012/03/18 17:35:06 hannes Exp $

 Description: 
-->

<!--
  The XML DTD for the WebConfig XML configuration document. Here follows 
  the form of the DOCTYPE:

    <!DOCTYPE WebConfig PUBLIC 
            "-//Toolbox Framework//DTD Web Configuration 1.0//EN"
            "http://javatoolbox.sourceforge.net/dtd/web_config_1_0.dtd">

  WebConfig instance documents relate to the following classes and interfaces:

    - toolbox.web.Controller (interface)
    - toolbox.web.ControllerServlet (concrete class)
    - toolbox.web.Finaliser (interface)
    - toolbox.web.WebAction (interface)
    - toolbox.web.BaseWebAction( concrete class)
    - toolbox.web.validation.Validator (interface)
    - toolbox.web.validation.ValidatorFactory (concrete class)
-->

<!--
  The WebConfig element is the root element of the configuration document.
-->

<!ELEMENT WebConfig (Validation?,Properties?,ControllerServlet)>


<!--
  The Validation element defines a collection of Validator instances.
-->

<!ELEMENT Validation (Validator+)>


<!--
  The Validator element defines the configuration for a single Validator
  instance that can be referenced by name from WebAction instances.

  A Validator instance has the following attributes:

  name    A symbolic name to identify the Validator. Must be unique within the
          Validation container element.

  class   The name of a Validator implementation class; a fully qualified Java
          Class name.

  config  A path, that will be interpreted relative to the web application 
          context, containing the Validator configuration properties.
-->

<!ELEMENT Validator EMPTY>
<!ATTLIST Validator
          name    CDATA  #REQUIRED
          class   CDATA  #REQUIRED
          config  CDATA  #REQUIRED
>


<!--
  The ControllerServlet element contains the configuration data required
  for the servlet to manage a set of WebAction implementations.
-->

<!ELEMENT ControllerServlet (Finaliser,
                             ViewService,
                             Resource,
                             DefaultTemplate?,
                             DefaultAction?,
                             WebActions)>


<!-- 
  The Finaliser elements specifies the Java implemenation class name of the
  Finaliser that will be used during the destruction of the ControllerServlet.
  The element may be empty.
-->

<!ELEMENT Finaliser (#PCDATA)> 


<!--
  The ViewService element specificies the location of the web application
  component responsible for rendering views. If the views are implemented
  as JSP's or static HTML pages use this element to specify a context relative
  path to the location of these files.  The element may be empty.
-->

<!ELEMENT ViewService (#PCDATA)>


<!--
  The Resource element specfies the base name of a java.util.ResourceBundle
  that will be used by the Servlet. The element may be empty.
-->

<!ELEMENT Resource (#PCDATA)>


<!--
  The DefaultTemplate element specifies the name of the template that must be
  rendered when the URL query parameters named action and template are null. 
  The template is also rendered when the DefaultAction element is null.
-->

<!ELEMENT DefaultTemplate (#PCDATA)>


<!--
  The DefaultAction element specifies the name of the action that must be
  executed when the URL query parameter named action is null. If this value is 
  not specified the DefaultTemplate is rendered.
-->

<!ELEMENT DefaultAction (#PCDATA)>


<!--
  The WebActions element defines a collection of 0 or more WebAction instances
  that must be managed by the ControllerServlet at runtime.
-->

<!ELEMENT WebActions (WebAction*)>


<!--
  The WebAction element defines the configuration of a single WebAction
  instance.

  A WebAction instance has the following attributes:

  name       A symbolic name to identify the WebAction instance. Must be 
             unique within the WebActions container.

  class      The name of a WebAction implementation class; a fully qualified
             Java Class name.

  validator  The symbolic name of a Validator instance configured in the
             Validation container.
-->

<!ELEMENT WebAction (message?,Templates,Properties?)>
<!ATTLIST WebAction
          name       CDATA  #REQUIRED
          class      CDATA  #REQUIRED
          validator  CDATA  #REQUIRED
>


<!--
  The message element is a legacy from older revisions of the toolbox.web 
  API and will be removed in future revisions of this DTD.
-->

<!ELEMENT message (#PCDATA)>


<!--
  The Templates element defines a collection of Template instances that will
  be used by the action in dispatching and redirecting operations.
-->

<!ELEMENT Templates (Template+)>


<!--
  The Template element defines a single Template that the action can use
  in dispatching and redirecting operations to render a required view. The
  content of the Template element will be interpreted as a context relative 
  path for dispatching and an absolute path for redirecting.

  The Template element has one attribute:

  name   A symbolic name to identify the template within the current Templates
         container.
-->

<!ELEMENT Template (#PCDATA)>
<!ATTLIST Template 
          name  CDATA  #REQUIRED
>


<!--
  The Properties element is a container for Property instances. Property 
  instances can be used to convey additional configuration information.

  The configuration document supports the use of the Properties element at
  two levels:

  * As a child of the WeConfig element. Properties at this level are visible
    to all WebAction implementations.

  * As a child of the WebAction element.  Properties at this level are only 
    visible to the specific WebAction instance.
-->

<!ELEMENT Properties (Property+)>


<!--
  The Property element defines a generic configuration property. 
-->

<!ELEMENT Property (#PCDATA)>
<!ATTLIST Property
          name    CDATA  #REQUIRED
>