# expatc: Compile DTD to expat

### Schema properties

<!-- P: defaultproperty.element.<property name>=<property value> -->
  This is similar to specifying
  <!-- P: <element name>.<property name>=<property value> -->
  for every element.
<!-- P: defaultproperty.attribute.<property name>=<property value> -->
  This is similar to specifying
  <!-- P: <element name>.<attribute name>.<property name>=<property value> -->
  for every attribute
<!-- P: parseconversion.<data type>=<function name> -->
  the generated code will contain a call to <function name> to convert from char * to <data type>. If <function name> contains %s, then %s will be replaced with the attribute value.
<!-- P: allocator=<expr> -->
  storage for objects will be allocated from <expr>
  Example: <!-- allocator=this->getAllocator () --> where this is the parser class.
<!-- P: customcode.<snippet name>=<statement> -->
  There exists several hooks where a code snippet can be inserted by the code generator. By using customcode, the same snippet can be referenced from several places.
<!-- P: attributealias.<attribute name>=<expression> -->
  For every attribute with name <attribute name>, the value is not taken from the XML document. Instead, <expression> is generated by the parser. (This is like a dynamic #FIXED attribute.)
<!-- P: default.constructor.arguments=<name list> -->
  <name list> is a comma separated list of identifiers. The first parameters of every element constructor are the attributealias entries for these names.
  Example:
  <!-- P: attributealias.xmlonly=XMLOnly () -->
  <!-- P: default.constructor.arguments=xmlonly -->
  ==> ... new Chapter (XML_Only (), ...)
<!-- P: attributes.<attribute name>.datatype=<datatype> -->
  This declares the data type for every attribute named <attribute name>.
<!-- P: parser.hpp.0=<filename> -->
  #include "<filename>" is added to the generated file. Multiple files can be specified with parser.hpp.1 etc.

### Element properties

<!-- P: <element name>.realclassprefix=<prefix> -->
  the name of the object class is constructed as <prefix><element name>
  Example: <!-- P: Outline.realclassprefix=FOMTEST_-->
<!-- P: <element name>.handlerclassprefix=<prefix> -->
  the name of the handler class is constructed as <prefix><element name>Handler
  Example: <!-- P: Outline.handlerclassprefix=FOMTEST_-->
<!-- P: <element name>.includepattern=<pattern> -->
  inserts an #include directive into the generated file.
  Example: <!-- P: Outline.includepattern=XML/FOMParser/Test/%s.hpp -->
  ==> #include "XML/FOMParser/Test/FOMTEST_Outline.hpp"
<!-- P: <element name>.<sub element name>.setter=<setter> -->
  the name of the method to set the sub element (default set<sub element name>).
<!-- P: <element name>.isString -->

- the tag may contain only character data
- no object of class <element name> is constructed
- a C++ string containing the character data is passed to containing lements

  Example:
  DTD: <!-- P: Title.isString -->
  DTD: <!ELEMENT Title (PCDATA)>
  C++: FOMTEST_Chapter::setTitle (const char & data);
<!-- P: <element name>.isGroup -->
  this is similar to declaring an abstract super class.
<!-- P: <element name>.group=<super class> -->
  this declares <element name> as a sub class of <super class>. <element name> tags may appear whenever <super class> is referenced in the DTD.
<!-- P: <element name>.postnew=<statement> -->
  <statement> is inserted after the call to the constructor. This is useful to insert the newly created object into additional containers. <statement> can be a C++ statement or a name for which a customcode-Property exists.
<!-- P: <element name>.postclose=<statement> -->
  <statement> is inserted after the closing tag has been found. <statement> can be a C++ statement or a name for which a customcode-Property exists.

### Attribute properties

<!-- P: <element name>.<attribute name>.setter=<setter> -->
  the name of the method to set the attribute (default set<attribute name>).
<!-- P: <element name>.<attribute name>.datatype=<datatype> -->
  the C++ data type of the attribute (default char *). Attribute values are converted from char * to this data type. see parseconversion
<!-- P: <element name>.<attribute name>.constructorparameter=<bool> -->
  specifies whether the attribute is passed as part of the constructor (true) or with a separate call to the setter method (false). The default is false.

2002-06-12 DanielD