<!-- datacapture4.5.dtd -->

<!-- Start with some basic parameter entities. -->
<!ENTITY  % data-capture-requirements-contentspec "symbol-table,ruleset*">
<!ENTITY  % items "container|item|itemref">
<!ENTITY  % chooser-options "option|inline">


<!ELEMENT data-capture-requirements (%data-capture-requirements-contentspec;)>
	<!ATTLIST data-capture-requirements
	  name	                 CDATA				#IMPLIED
	  type	                 (metadata|content|workflow)	#REQUIRED
	  dtd-system-identifier  CDATA                          #IMPLIED
	  >
<!-- The 'dtd-system-identifier' attribute is a URI indicating the
     DTD from whence a particular data-capture-requirements was
     derived, if any.

     In TeamSite Templating, the value of this attribute is used as
     the system identifier of the document type declaration of a DCR
     if and only if that DCR's type is "xml", as defined in
     templating.cfg.
     -->

<!ELEMENT symbol-table   (symbol*) >

<!ELEMENT symbol        (%items;)? >
        <!ATTLIST symbol
          name  CDATA           #IMPLIED
          regex CDATA           #IMPLIED
	  >
	  
<!ELEMENT ruleset	(label?,description?,(%items;)*) >
	<!ATTLIST ruleset
	  name	CDATA		#REQUIRED
	  >

<!ELEMENT container     (label?,description?,(%items;)*) >
        <!ATTLIST container
	  name         CDATA           #REQUIRED
	  hide-name    (t|f)           "f"
	  combination  (and|or)        "and"
	  >
	  
<!ELEMENT itemref	EMPTY >
        <!ATTLIST itemref
          name  CDATA           #REQUIRED
          >

<!ELEMENT item		(label?,description?,database?,(checkbox|radio|text|textarea|select|replicant|browser|readonly|hidden)+) >
	<!ATTLIST item 
	  name		CDATA		#REQUIRED
	  >
<!ELEMENT label         (#PCDATA) >
<!ELEMENT description	(#PCDATA) >

<!ELEMENT text		(allowed?,callout?,default?) >
	<!ATTLIST text
	  required 		(t|f)		"f"
	  maxlength		CDATA		"0"
	  size			CDATA		"0"
	  validation-regex	CDATA		#IMPLIED
          >
<!-- validation-regex is a Perl regex for validating this element -->

<!ELEMENT textarea	(allowed?,callout?,default?) >
	<!ATTLIST textarea
	  required 		(t|f)			"f"
	  rows			CDATA			"0"
	  cols			CDATA			"0"
	  wrap			(off|virtual|physical)	"off"
	  validation-regex	CDATA			#IMPLIED
	  rtf			(t|f)			"f"
          >
<!-- validation-regex is a Perl regex for validating this element -->

<!ELEMENT browser	(allowed?,callout?) >
	<!ATTLIST browser
	  required	(t|f)		"f"
	  maxlength	CDATA		"0"
	  size		CDATA		"0"
	  initial-dir	CDATA		#IMPLIED
	  ceiling-dir	CDATA		#IMPLIED
	  extns		CDATA		#IMPLIED
	  >

<!ELEMENT readonly	(allowed?,callout?) >
	  
<!ELEMENT hidden	(allowed?,callout?) >
	<!ATTLIST hidden
	  required	(t|f)		"f"
	  >

<!ELEMENT checkbox	(allowed?,callout?,(%chooser-options;)+) >
	<!ATTLIST checkbox
	  required 	(t|f)		"f"
	  delimiter	CDATA		", "
	  >
<!ELEMENT radio		(allowed?,callout?,(%chooser-options;)+) >
	<!ATTLIST radio
	  required 	(t|f)		"f"
	  >
<!ELEMENT select	(allowed?,callout?,(%chooser-options;)+) >
	<!ATTLIST select
	  required 	(t|f)		"f"
	  size		CDATA		"0"
	  multiple	(t|f)		"f"	
	  delimiter	CDATA		", "
	  width		CDATA		#IMPLIED
          >
<!-- The delimiter attribute is for multiple=t only -->

<!ELEMENT option		EMPTY >
	<!ATTLIST option 
	  selected	(t|f)		"f"
	  value		CDATA		#IMPLIED
	  label		CDATA		#REQUIRED
	  >

<!ELEMENT replicant	(allowed?,(%items;)*) >
	<!ATTLIST replicant
	  min		CDATA		"0"
	  max		CDATA		"1"
	  default	CDATA		"1"
	  combination	(and|or)	"and"
	  hide-name     (t|f)           "f"
	  >
	  
<!ELEMENT allowed (cred|and|or|not) >

<!ELEMENT cred EMPTY >
	<!ATTLIST cred 
	  role		CDATA		#IMPLIED
	  user		CDATA		#IMPLIED
	  >

<!ELEMENT and ((cred|and|or|not)+) >

<!ELEMENT or  ((cred|and|or|not)+) >

<!ELEMENT not (cred|and|or|not) >

<!ELEMENT default	(#PCDATA) >

<!ELEMENT callout	(param*) >
	<!ATTLIST callout
	  type			(java-class)    #REQUIRED
	  label			CDATA		#REQUIRED
	  location		CDATA		#REQUIRED
	  class			CDATA		#REQUIRED
	  >

<!ELEMENT param		EMPTY >
	<!ATTLIST param
	  name	  CDATA		#REQUIRED
	  value	  CDATA		#REQUIRED
	  >

<!ELEMENT database	EMPTY >
	<!ATTLIST database
	  deploy-column (t|f)		"t"
	  searchable    (t|f)		"t"
	  data-type     CDATA		"VARCHAR(255)"
	  data-format   CDATA		#IMPLIED
	  >

<!-- An 'inline' element should have a 'command' attribute.  e.g.:
          <inline command="/bin/cat /tmp/a /tmp/b"/>

     The callout program should return a well-formed XML document.
     The document's outermost element should be a "substitution"
     element.  It should contain any XML that is valid according
     to this DTD.

     That "substitution" element's contents will replace the
     "inline" element in the datacapture.cfg file.
     
     So, if this DCT snippet:
     
     <select>
     <inline command="blah" />
     </select>
     
     runs the "blah" callout program, and that program returns this text:
     
     <substitution>
     <option label="ABC" />
     <option label="123" />
     <option label="Jackson 5" />
     </substitution>
     
     then the DCT snippet will, after callout execution and inline
     substitution, look like:
     
     <select>
     <option label="ABC" />
     <option label="123" />
     <option label="Jackson 5" />
     </select>
     -->
     
<!ELEMENT inline	EMPTY >
	<!ATTLIST inline
	  command	CDATA		#REQUIRED
	  >
