By default edit-on Pro will validate documents loaded against the XHTML transitional DTD. If the document is invalid, it will perform a clean-up on the document and remove any elements and attributes not allowed in the DTD specified. If you want to use elements and attributes not specified in the XHTML transitional DTD, but still like to validate the document in the editor against a DTD, you can do this by either loading a document or a template with a custom DocType into the editor.
Example II.17. Specifying a custom DocType in a document or template
<!DOCTYPE mydoctype SYSTEM "mydoctype.dtd">
In the example above, we use the DocType mydoctype , defined in the DTD mydoctype.dtd . Instead of indicating a DTD available on your server, you could of course also specify a public DocType.
If you specify a custom DTD with a relative path, it will be resolved relative to the code base per default. You can set a base URL for DTDs by using the JavaScript API function setDTDBase . If setDTDBase is specified, all DTDs with a relative path will be resolved relative to the URL specified by setDTDBase . For details, see the chapter JavaScript Configuration API .
Example II.18. Specifying a public DocType in a document or template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">The default DocType supported by edit-on Pro is XHTML transitional. Content created using the editor will be valid XHTML transitional by default. Although edit-on Pro can validate documents against other DTDs and clean them if necessary, the editing functionality of the editor will not be modified by the custom DTD i.e. it will still create content according to the XHTML transitional DTD. If for example you were using a custom DTD with no tables allowed, it may still be possible to create tables using the editor. In this case, you have to make sure the table dialogs are deactivated and that tables are removed when the document is saved. You can do so by settable.ing the validateonsave attribute of the documentvalidation element to true in the configuration file and enabling and configuring the clean-up process to remove illegal elements and attributes.
Custom tags have to be defined in a custom DTD so they can be used in edit-on Pro. To do so, you can either create your own custom DTD, or use the xhtml1-transitional-eop.dtd which is provided in the edit-on Pro installation package. The xhtml1-transitional-eop.dtd basically corresponds to the standard XHTML transitional 1.0 DTD, with the exceptions that two entities were added ( eopcustomblock and eopcustominline ) and that this DTD references another DTD, eopcustomelements.dtd . Now you can define all custom elements and their attributes in eopcustomelements.dtd by adding the required elements either to the eopcustomblock or eopcustominline entity, depending on whether you require inline or block elements or both. Next, add the element and attribute definitions to the DTD.
Example II.19. Sample eopcustomelements.dtd
<!ENTITY % eopcustomblock "myblock"> <!ENTITY % eopcustominline "myinline"> <!ELEMENT myblock ANY> <!ATTLIST myblock id CDATA #IMPLIED name CDATA #REQUIRED > <!ELEMENT myinline EMPTY>
In the example above, we defined a custom block level element called myblock and a custom inline element called myinline . The element myblock has two attributes, id and name , the latter being required, i.e. it is always inserted with the element myblock . The element myinline is defined as an empty inline element.
Now all there is left to do is to make sure the editor always validates content against the xhtml1-transitional-eop.dtd , which in turn includes the eopcustomelements.dtd . This can be done by referencing the xhtml1-transitional-eop.dtd in a template loaded by the editor. For details about templates, please see Template Based Editing .