XML provides a rich system for defining complex documents and data structures. Dreamweaver uses several XML schemas to organize information about server behaviors, tags and tag libraries, components, document types, and reference information.

When you create and work with extensions in Dreamweaver, there are many instances in which you create or modify existing XML files to manage the data that your extension uses. In many cases, you can copy an existing file from the appropriate subfolder within the Configuration folder to use as a template.

Document type definition files

The central component of extensible document types is the document type definition file. There might be several definition files, all of which are located in the Configuration/DocumentTypes folder. Each definition file contains information about at least one document type. For each document type, essential information such as server model, color coding style, descriptions, and so forth, is described.

Note:

Do not confuse Dreamweaver document type definition files with the XML document type definition (DTD). Document type definition files in Dreamweaver contain a set of documenttype elements, each of which defines a predefined collection of tags and attributes that are associated with a document type. When Dreamweaver starts, it parses the document type definition files and creates an in-memory database of information regarding all defined document types.

Dreamweaver provides an initial document type definition file. This file, named MMDocumentTypes.xml, contains the document type definitions provided by Adobe:

Document type

Server model

Internal type

File extensions

Previous server model

ASP.NET C#

ASP.NET-Csharp

Dynamic

aspx, ascx

ASP.NET VB

ASP.NET-VB

Dynamic

aspx, ascx

ASP JavaScript

ASP-JS

Dynamic

asp

 

ASP VBScript

ASP-VB

Dynamic

asp

 

ColdFusion

ColdFusion

Dynamic

cfm, cfml

UltraDev 4 ColdFusion

ColdFusion Component

 

Dynamic

cfc

 

JSP

JSP

Dynamic

jsp

PHP

PHP

Dynamic

php, php3

 

Library Item

 

DWExtension

lbi

 

ASP.NET C# Template

DWTemplate

axcs.dwt

ASP.NET VB Template

DWTemplate

axvb.dwt

ASP JavaScript Template

 

DWTemplate

aspjs.dwt

 

ASP VBScript Template

 

DWTemplate

aspvb.dwt

 

ColdFusion Template

 

DWTemplate

cfm.dwt

 

HTML Template

 

DWTemplate

dwt

 

JSP Template

 

DWTemplate

jsp.dwt

 

PHP Template

 

DWTemplate

php.dwt

 

HTML

 

HTML

htm, html

 

ActionScript

 

Text

as

 

CSharp

 

Text

cs

 

CSS

 

Text

css

 

Java

 

Text

java

 

JavaScript

 

Text

js

 

VB

 

Text

vb

 

VBScript

 

Text

vbs

 

Text

 

Text

txt

 

EDML

 

XML

edml

 

TLD

 

XML

tld

 

VTML

 

XML

vtm, vtml

 

WML

 

XML

wml

 

XML

 

XML

xml

 

If you need to create a new document type, you can either add your entry to the document definition file that Adobe provides (MMDocumentTypes.xml) or add a custom definition file to the Configuration/DocumentTypes folder.

Note:

The NewDocuments subfolder resides in the Configuration/DocumentTypes folder. This subfolder contains default pages (templates) for each document type.

Structure of document type definition files

The following example shows what a typical document type definition file looks like:

 <?xml version="1.0" encoding="utf-8"?> 
<documenttypes     xmlns:MMString="http://www.adobe.com/schemes/data/string/"> 
    <documenttype 
        id="dt-ASP-JS" 
        servermodel="ASP-JS" 
        internaltype="Dynamic" 
        winfileextension="asp,htm, html" 
        macfileextension="asp, html" 
        previewfile="default_aspjs_preview.htm" 
        file="default_aspjs.htm" 
        priorversionservermodel="UD4-ASP-JS" > 
        <title> 
            <loadString id="mmdocumenttypes_0title" /> 
        </title> 
        <description> 
            <loadString id="mmdocumenttypes_0descr" /> 
        </description> 
    </documenttype> 
    ... 
</documenttypes>

Note:

Color coding for document types is specified in the XML files that reside in the Configuration/CodeColoring folder.

In the previous example, the loadString element identifies the localized strings that Dreamweaver uses for the title and description for ASP-JS type documents. For more information about localized strings, see Providing localized strings.

The following table describes the tags and attributes that you can use within a document type definition file.

Tag

Attribute

Required

Description

documenttype

(root)

 

Yes

Parent node.

 

id

Yes

Unique identifier across all document type definition files.

 

servermodel

No

Specifies the associated server model (case-sensitive); by default, the following values are valid:

ASP.NET C#

ASP.NET VB

ASP VBScript

ASP JavaScript

ColdFusion

JSP

PHP MySQL

A call to the getServerModelDisplayName() functions returns these names. The server model implementation files are located in the Configuration/ServerModels folder.

Extension developers can create new server models by extending this list.

 

internaltype

Yes

A broad classification of how Dreamweaver treats a file. The internaltype identifies whether the Design view is enabled for this document and handles special cases such as Dreamweaver templates or extensions.

The following values are valid:

Dynamic

DWExtension (has special display regions)

DWTemplate (has special display regions)

HTML

HTML4

Text (Code view only)

XHTML1

XML (Code view only)

All server model-related document types map to Dynamic. HTML maps to HTML. Script files (such as CSS, JS, VB, and CS) map to Text.

If internaltype is DWTemplate, specify the dynamicid. Otherwise, the Server Behavior or Bindings panel does not recognize the new blank template that the New Document dialog box creates. Instances of this template are simply an HTML template.

 

dynamicid

No

A reference to the unique identifier of a dynamic document type. This attribute is meaningful only when internaltype is DWTemplate. This attribute lets you associate a dynamic template with a dynamic document type.

 

winfileextension

Yes

The filename extension that is associated with the document type on Windows. You specify multiple filename extensions by using a comma-separated list. The first extension in the list is the extension that Dreamweaver uses when the user saves a documenttype document.

If two nonserver model-related document types have the same filename extension, Dreamweaver recognizes the first one as the document type for the extension.

 

macfileextension

Yes

The filename extension that is associated with the document type on the Macintosh. You specify multiple filename extensions by using a comma-separated list. The first extension in the list is the extension that Dreamweaver uses when the user saves a documenttype document.

If two nonserver model-associated document types have the same filename extension, Dreamweaver recognizes the first one as the document type for the extension.

 

previewfile

No

The file that is rendered in the Preview area of the New Document dialog box.

 

file

Yes

The file that is located in the DocumentTypes/NewDocuments folder that contains template content for new documenttype documents.

 

priorversionservermodel

No

If the server model of this document has a Dreamweaver UltraDev 4 equivalent, specify the name of the older version of the server model.

UltraDev 4 ColdFusion is a valid prior server model.

title

(subtag)

 

Yes

The string that appears as a category item under Blank Document in the New Document dialog box. You can place this string directly in the definition file or point to it indirectly for localization purposes. For more information on localizing this string, see Providing localized strings.

Formatting is not allowed, so HTML tags cannot be specified.

description

(subtag)

 

No

The string that describes the document type. You can place this string directly in the definition file or point to it indirectly for localization purposes. For more information on localizing this string, see Providing localized strings.

Formatting is allowed, so HTML tags can be specified.

Note:

When the user saves a new document, Dreamweaver examines the list of extensions for the current platform that are associated with the document type. For example, winfileextension and macfileextension. Dreamweaver selects the first string in the list and uses it as the default filename extension. To change this default filename extension, reorder the extensions in the comma-separated list so the new default is listed first.

When Dreamweaver starts, it reads all document type definition files and builds a list of valid document types. Dreamweaver treats any entries within the definition files that have nonexistent server models as nonserver model document types. Dreamweaver ignores entries that have bad contents or IDs that are not unique.

If document type definition files are corrupt or are not available in the Configuration/DocumentTypes folder, Dreamweaver closes with an error message.

Defining dynamic templates

You can create templates that are based on dynamic document types. These templates are called dynamic templates. The following two elements are essential to defining a dynamic template:

  • The value of the internaltype attribute for the new document type must be DWTemplate.

  • The dynamicid attribute must be set, and the value must be a reference to the identifier of an existing dynamic document type.

    The following example defines a dynamic document type:

     <documenttype id="PHP_MySQL" servermodel="PHP MySQL" internaltype="Dynamic" winfileextension="php,php3" macfileextension="php,php3" file="Default.php"> <title>PHP</title> <description><![CDATA[PHP document]]></description> </documenttype>

    Now, you can define the following dynamic template, which is based on this PHP_MySQL dynamic document type:

     <documenttype id="DWTemplate_PHP" internaltype="DWTemplate" dynamicid="PHP_MySQL" winfileextension="php.dwt" macfileextension="php.dwt" file="Default.php.dwt"> <title>PHP Template</title> <description><![CDATA[Dreamweaver PHP Template document]]></description> </documenttype>

When a Dreamweaver user creates a new blank template of type DWTemplate_PHP, Dreamweaver lets the user create PHP server behaviors in the file. Furthermore, when the user creates instances of the new template, the user can create PHP server behaviors in the instance.

In the previous example, when the user saves the template, Dreamweaver automatically adds a .php.dwt extension to the file. When the user saves an instance of the template, Dreamweaver adds the .php extension to the file.

Adding and modifying document extensions and file types

By default, Dreamweaver shows all the file types it recognizes in the File > Open dialog box. After creating a document type, extension developers must update the appropriate Extensions.txt file. At times, the user maybe on a multiuser system (such as Windows XP, Windows Vista, or Mac OS X). In such cases, another Extensions.txt file exists in the user Configuration folder. The user must update the Extensions.txt file because it is the instance that Dreamweaver looks for and parses.

The location of the Configuration folder of the user depends on the platform of the user.

Windows XP platform uses the following location:

hard disk:\Documents and Settings\username\Application Data\Adobe\Dreamweaver CS5\Configuration

Note:

It is possible that this folder is inside a hidden folder.

Windows Vista platform uses the following location:

hard disk:\Users\username\AppData\Roaming\Adobe\Dreamweaver CS5\Configuration

Mac OS X platform uses the following location:

hard disk:\Users/username/Library/Application Support/Adobe/Dreamweaver CS5/Configuration

If Dreamweaver cannot find the Extensions.txt file in the Configuration folder of the user, Dreamweaver looks for it in the Dreamweaver Configuration folder.

Note:

On multiuser platforms, Dreamweaver parses the copy of the Extensions.txt file in the Configuration folder of the user, not the file in the Dreamweaver Configuration folder. So, if you edit the copy of Extensions.txt that resides in the Dreamweaver Configuration folder, Dreamweaver is not aware of the changes.

To create a document extension, you can either add the new extension to an existing document type or create a document type.

Add a new extension to an existing document type

  1. Edit MMDocumentTypes.xml.

  2. Add the new extension to the winfileextension and macfileextension attributes of the existing document type.

Add a new document type

  1. Make a backup copy of the Extensions.txt file in the Configuration folder.

  2. Open Extensions.txt in a text editor.

  3. Add a new line for each new file type. In capital letters, enter the filename extensions that the new file type can have, separated by commas. Then, add a colon and a brief descriptive phrase to show in the pop-up menu for file types. The pop-up menu appears in the File > Open dialog box.

    For example, for JPEG files, enter JPG,JPEG,JFIF:JPEG Image Files

  4. Save the Extensions.txt file.

  5. Restart Dreamweaver.

To see the changes, select File > Open and click the pop-up menu of file types.

Change the Dreamweaver default File > 0pen file type

  1. Make a backup copy of the Extensions.txt file in the Configuration folder.

  2. Open Extensions.txt in a text editor.

  3. Cut the line that corresponds to the new default. Then, paste it at the beginning of the file to make it the first line of the file.

  4. Save the Extensions.txt file.

  5. Restart Dreamweaver.

To see the changes, select File > Open and click the pop-up menu of file types.

Providing localized strings

Within a document type definition file, the <title> and <description> subtags specify the display title and description for the document type. You can use the MMString:loadstring directive in the subtags as a placeholder for providing localized strings for the two subtags. This process is similar to server-side scripting where you specify a particular string to use in your page by using a string identifier as a placeholder. For the placeholder, you can use a special tag or you can specify a tag attribute whose value is replaced.

Provide localized strings

  1. Place the following statement at the beginning of the document type definition file:

     <?xml version="1.0" encoding="utf-8"?>
  2. Declare the MMString namespace in the <documenttypes> tag:

     <documenttypes 
        xmlns:MMString="http://www.adobe.com/schemes/data/string/">
  3. At the location in the document type definition file where you want to provide a localized string, use the MMString:loadstring directive to define a placeholder for the localized string. You can specify this placeholder in one of the following ways:

         <description> 
            <loadstring>myJSPDocType/Description</loadstring> 
        </description>

    Or

    <description> 
            <loadstring id="myJSPDocType/Description" /> 
        </description>

    In these examples, myJSPDocType/Description is a unique string identifier that acts as a placeholder for the localized string. The localized string is defined in the next step.

  4. In the Configuration/Strings folder, create a new XML file (or edit an existing file) that defines the localized string. For example, the following code, when placed in the Configuration/Strings/strings.xml file, defines the myJSPDocType/Description string:

         <strings> 
        ... 
            <string id="myJSPDocType/Description" 
                value= 
                "<![CDATA[JavaServer&nbsp;Page with <em>special</em> features]]>" 
            /> 
        ... 
        </strings>

Note:

String identifiers, such as myJSPDocType/Description in the previous example, must be unique within the application. Dreamweaver, when it starts, parses all XML files within the Configuration/Strings folder and loads these unique strings.

Rules for document type definition files

Dreamweaver lets document types that are associated with a server model share file extensions. For example, ASP-JS and ASP-VB can claim .asp as their file extension. (For information on which server model gets preference, see canRecognizeDocument().)

Dreamweaver does not let document types that are not associated with a server model share file extensions.

If a file extension is claimed by two document types where one type is associated with a server model and the other is not, the latter document type gets preference. Suppose you have a document type called SAM, which is not associated with a server model, that has a file extension of .sam, and you add this file extension to the ASP-JS document type. When a Dreamweaver user opens a file that has a .sam extension, Dreamweaver assigns the SAM document type to it, not ASP-JS.

Defining document declarations

Dreamweaver lets setting DTDs for documents through the MMDocumentTypeDeclarations.xml file available in the Configuration/DocumentTypes folder. The list of available DTDs and the documents they apply to is defined in the MMDocumentTypeDeclarations.xml file.

Opening a document in Dreamweaver

When a user opens a document file, Dreamweaver follows a series of steps to identify the document type based on the file’s extension.

If Dreamweaver successfully finds a unique document type, Dreamweaver uses that type and loads the associated server model (if any) for the document that the user is opening. If the user has selected to use Dreamweaver UltraDev 4 server behaviors, Dreamweaver loads the appropriate UltraDev 4 server model.

If the file extension maps to more than one document type, Dreamweaver performs the following actions:

  • If a static document type is among the list of document types, it gets preference.

  • If all the document types are dynamic, Dreamweaver creates an alphabetical list of the server models that are associated with these document types and then calls the canRecognizeDocument() function in each server model (see canRecognizeDocument()). Dreamweaver collects the return values and determines which server model returned the highest valued positive integer. The document type whose server model returns the highest integer is the document type that Dreamweaver assigns to the document being opened. If, however, more than one server model returns the same integer, Dreamweaver goes through the alphabetical list of those server models, picks the first in the list, and uses that document type. For example, if both ASP-JS and ASP-VB claim an ASP document and if their respective canRecognizeDocument() functions return equal values, Dreamweaver assigns the document to ASP-JS (because, alphabetically, ASP-JS is first).

If Dreamweaver cannot map the file extension to a document type, Dreamweaver opens the document as a text file.

Customizing workspace layouts

Dreamweaver lets you customize the workspace layout, including which panels are in the specified layout, as well as other attributes such as the positions and sizes of the panels, their collapsed or expanded states, the position and size of the application window, and the position and size of the Document window.

The workspace layout is specified in XML files stored in the Configuration/Workspace layouts folder. The following sections describe the syntax of the XML tags. Optional attributes are marked in the attribute lists with curly braces ({}); all attributes not marked with curly braces are required.

Description

Outermost tag, which signals the start of the panel set description.

Attributes

None.

Contents

This tag may contain one or more application, document, or panelset tags.

Container

None.

Example

 <panelset> 
    <!-- panelset tags here --> 
</panelset>

Description

Specifies the application window’s initial position and size.

Attributes

rect, maximize

  • rect specifies the position and size of the application window. The string is in the form “left top right bottom” specified as integers.

  • maximize is a Boolean value: true if the application window should be maximized on startup; false otherwise. The default value is true.

Contents

None.

Container

This tag must be contained in a panelset tag.

Example

 <panelset> 
    <application rect="0 0 1000 1200" maximize="false"> 
    </application> 
</panelset>

Description

Specifies the Document window’s initial position and size.

Attributes

rect, maximize

  • rect specifies the position and size of the Document window. The string is in the form “left top right bottom” specified as integers. If the maximize value is true, the rect value is ignored.

  • maximize is a Boolean value: true if the Document window should be maximized on startup; false otherwise. The default value is true.

Contents

None.

Container

This tag must be contained in a panelset tag.

Example

 <panelset> 
    <document rect="100 257 1043 1200" maximize="false"> 
    </document> 
</panelset>

Description

Describes an entire panel group.

Attributes

x, y, {width, height}, dock, collapse

  • x specifies the left position of the panel group. Its value can be an integer or a value that is relative to the screen. If the integer value is not on the screen, the panel group appears in the closest screen position possible to make it visible on the screen. Relative values can be “left” or “right”; these values indicate which edge of the panel group to align with which edge of the virtual screen.

  • y specifies the top position of the panel group. Its value can be an integer or a value that is relative to the screen. If the integer value is not on the screen, the panel group appears in the closest screen position possible to make it visible on the screen. Relative values can be “top” or “bottom”; these values indicate which edge of the panel group to align with which edge of the virtual screen.

  • width is the width, in pixels, of the panel group. This attribute is optional. If the width is not specified, the built-in default for the panel group is used.

  • height is the height, in pixels, of the panel group. This attribute is optional. If the height is not specified, the built-in default for the panel group is used.

  • dock is a string value that specifies to which edge of the application frame to dock the panel group. This attribute is ignored on the Macintosh because panel groups cannot be docked.

  • collapse is a Boolean value: true indicates that the panel group is collapsed: false indicates that the panel group is expanded. This attribute is ignored on the Macintosh because panels are floating.

Contents

This tag must contain one or more panelcontainer tags.

Container

This tag must be contained in a panelset tag.

Example

 <panelset> 
    <panelframe rect="196 453 661 987" visible="true" dock="floating"> 
        <!-- panelcontainer tags here --> 
    </panelframe> 
</panelset>

Description

Describes an entire panel group.

Attributes

expanded, title,{ height,} activepanel, visible, maximize, maxRestorePanel, maxRestoreIndex, maxRect, tabsinheader

  • expanded is a Boolean value: true if the panel is expanded; false otherwise.

  • title is a string that specifies the title of the panel.

  • height is an integer that specifies the height of the panel in pixels. This attribute is optional. If height is not specified, the build-in default for each panel is used.

    Note: Width is inherited from the parent.

  • activepanel is a number that is the ID of the front panel.

  • visible is a Boolean value: true if the panel is visible; false otherwise.

  • maximize is a Boolean value: true if the panel should be maximized when it appears initially; false otherwise.

  • maxRestorePanel is a number that is the ID of the panel to restore to.

  • maxRect is a string that indicates the position and size of the panel when it is maximized. The string is in the form “left top right bottom”, specified as integers.

  • tabsinheader is a Boolean value: true indicates that tabs should be positioned in the header instead of below the header bar; false otherwise.

Contents

This tag must contain one or more panel tags.

Container

This tag must be contained in a panelframe tag.

Example

 <panelset> 
    <panelframe rect="196 453 661 987" visible="true" dock="floating"> 
        <panelcontainer title="Color" height="250" visible="true" expanded="true" 
        activepanel="20"> 
            <!-- panel tags here ---> 
        </panelcontainer> 
    </panelframe> 
</panelset>

Description

Specifies the panel that appears in the panel container.

Attributes

id, visibleTab

  • id is a number that indicates the ID for the panel. The following table contains a list of values:

    Software

    ID

    Panel

    Adobe® Flash®

    1

    Properties

     

    2

    Actions

     

    3

    Align

     

    4

    Behaviors

     

    5

    Components

     

    6

    Component Inspector

     

    7

    Color Mixer

     

    8

    Color Swatches

     

    9

    History

     

    10

    Info

     

    11

    Library

     

    12

    Movie Explorer

     

    13

    Output

     

    14

    Properties

     

    15

    Project

     

    16

    Transform

     

    17

    Scene

     

    18

    Strings

     

    19

    Debugger

     

    101–110

    Library

    Dreamweaver

    1

    Properties

    Flex Builder

    1

    Properties

  • visibleTab is a Boolean value: true if the tab and the panel should be visible; false otherwise.

Contents

None.

Container

This tag must be contained in a panelcontainer tag.

Example

 <panelset> 
    <panelframe rect="196 453 661 987" visible="true" dock="floating"> 
        <panelcontainer title="Color" height="250" visible="true" expanded="true" 
        activepanel="20"> 
            <panel id="20"></panel> 
        </panelcontainer> 
    </panelframe> 
</panelset>

Customizing the Coding toolbar

The Coding toolbar displays 15 buttons initially. This is a subset of the buttons that are available. You can customize the Coding toolbar by changing the buttons that appear on the toolbar and the order in which they appear by editing the file Configuration/Toolbars/Toolbars.xml. You can also insert your own buttons into the toolbar through the Extension Manager.

Change the order of buttons

  1. Open the file Configuration/Toolbars/toolbars.xml.

  2. Locate the Code view toolbar section by searching for the following comment:

     <!-- Code view toolbar -->
  3. Copy and paste the button tags so that they appear in the order you want on the toolbar.

  4. Save the file.

Remove a button

  1. Open the file Configuration/Toolbars/toolbars.xml.

  2. Locate the Coding toolbar section by searching for the following comment:

     <!-- Code view toolbar -->
  3. Surround the button you want to remove with a comment.

    The following example shows a button that is surrounded by comments so that it does not appear on the toolbar:

     <!-- remove button from Coding toolbar 
        <button id="DW_ExpandAll" 
            image="Toolbars/images/MM/T_ExpandAll_Sm_N.png" 
            disabledImage="Toolbars/images/MM/T_ExpandAll_Sm_D.png" 
            tooltip="Expand All" 
            domRequired="false" 
            enabled="dw.getFocus(true) == 'textView' || dw.getFocus(true) == 'html'¬ 
                "command="if (dw.getFocus(true) == 'textView' || dw.getFocus(true) ¬ 
                == 'html') dw.getDocumentDOM().source.expandAllCodeFragments();" 
            update="onViewChange" /> 
    -->
  4. Save the file.

To make any buttons that are not visible in the toolbar appear, you remove the comment that surrounds a button in the XML file.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy