Document Types > Document Type Configuration (.dcf) > Inserting Elements and Text Automatically
  
Inserting Elements and Text Automatically
You can configure a list of elements and text in the .dcf file that Arbortext Editor automatically inserts when an element is inserted.
For example, you can configure your document type so that when Arbortext Editor users convert text within a paragraph to a list, both list wrapper and list item tags are automatically inserted around any selected text.
To configure automatic element and text insertion:
1. Open Arbortext Architect.
2. Choose File > Open.
3. Locate the directory in which the document type whose .dcf file you want to modify is saved, and click Select.
4. Once the document type is loaded, choose Edit > DCF. If the document type has a .dcf file, it displays in the Arbortext ArchitectDCF Editor window. If there is no .dcf file associated with this document type, Arbortext Architect automatically creates one.
5. Locate the ContextTransformations element in the DCF Editor. If the file doesn't include a ContextTransformations element, add one.
* 
Open the Document Type Viewer (Tools > Document Type Viewer) to view the element hierarchy for the .dcf file. This will help you determine the valid location for the ContextTransformations element.
6. Place your cursor next to the ContextTransformations element, choose Insert > Markup, and then choose InsertAutoWithin.
7. Click next to the InsertAutoWithin element to open the Modify Attributes dialog box.
* 
You must have the Force Required Attributes EntryEdit preference selected for this dialog box to open automatically.
8. In the element field, select the element for which you want to create a automatic insertions.
9. Click OK.
10. In the DCF Editor, highlight the InsertAutoWithin element, and choose Edit > Edit Selection as XML Source.
11. Add the elements that you want to be automatically inserted when the element identified in the previous step is inserted in a document. You must provide a namespace prefix for elements you are inserting.
* 
You must conform to XML syntax for the contents of the InsertAutoWithin for both XML and SGML document types. Singleton tags should be written as <namespace:singleton/>.
Also, spaces or line feeds inside the InsertAutoWithin contents are recognized as such.cc
For example,
<InsertAutoWithin element="author"
xmlns:axdocbook-customized="axdocbook-customized.dtd">
<axdocbook-customized:honorific>Dr.</axdocbook-customized:honorific>
</InsertAutoWithin>
would automatically insert the honorific element with Dr. as the content when author is inserted.
12. Specify the cursor location after an automatic insert. The InsertAutoCaret tag indicates where the cursor will be after the insertion is completed. If you do not specify a cursor location, the cursor is placed after the inserted element.
In the following example, the cursor will be placed within the firstname tags:
<InsertAutoWithin element="author" xmlns:axdocbook-customized="axdocbook-customized.dtd">
<axdocbook-customized:honorific>Dr.</axdocbook-customized:honorific>
<axdocbook-customized:firstname><InsertAutoCaret/></axdocbook-customized:firstname>
13. Specify the insertion location. The InsertAutoSelection indicates where existing content is placed (when you're inserting an element around content). If you do not specify InsertAutoSelection, existing content will go after the automatically inserted content.
In the following example, the existing content will be placed within the surname tags:
<InsertAutoWithin element="author" xmlns:axdocbook-customized="axdocbook-customized.dtd">
<axdocbook-customized:honorific>Dr.</axdocbook-customized:honorific>
<axdocbook-customized:firstname><InsertAutoCaret/></axdocbook-customized:firstname>
<axdocbook-customized:surname><InsertAutoSelection/></axdocbook-customized:surname>
14. Choose File > Update Selection in the XML Source window to return to the DCF Editor.
15. Choose File > Save to save the changes you have made to the .dcf file.
* 
When authors add markup using the Table Editor, only the cell element receives InsertAutoWithin content