decorative banner

Changing the doctype of a document


    If you choose File > New Special to create an HTML document, an XHTML document, a WML Deck, or a SMIL document, GoLive automatically sets the doctype for you and selects a default DTD. (See Creating special documents.) If you choose File > New Page, GoLive doesn't set a doctype for the document.

    With the exception of SMIL documents, you can set or change the doctype after the document has been created, within certain restrictions. For example, you can change the doctype of an HTML document, or you can convert a document from HTML to XHTML and then choose an XHTML doctype. But, you can't change a WML Deck document to HTML. For best results, start by creating the type of special document you want to ultimately deploy.

To set or change the doctype of a document:

  1. In the Layout Editor, display the document window menu. (See Using the page design tools.)
  2. Choose Doctype, and then choose a doctype from the menu. The menu is context-sensitive--that is, if you are editing an HTML document, the valid HTML DTDs are available. For an XHTML document, the XHTML DTDs are available, and for any other doctype, the associated DTDs in the Markup tab of Web Settings are available. For example, for a WML Deck document, the WML DTDs are available. (See Using the Markup tab.)
  3. Note: If you associate imported DTDs with text or XML files in the Markup tab of Web Settings, those DTDs are also available on the Doctype menu.(See Importing a Document Type Definition (DTD) file.)

    After you choose a doctype from the Doctype menu, GoLive sets the document's doctype by inserting or changing the !DOCTYPE declaration at the beginning of the document's source code. The doctype you set is also selected as the default DTD in the Syntax Checker. (See Checking syntax.)

To convert the doctype of a document from HTML to XHTML:

  1. In the Layout Editor, choose Markup from the document window menu, and then choose Convert to XHTML. The Convert to XHTML dialog box opens.
  2. To make your converted XHTML document compatible with more browsers, select the following options to set how GoLive converts the document from HTML to XHTML:
    • Wrap <style> Content Into CDATA wraps all of the text inside style sheets to prevent GoLive from mistakenly interpreting the special characters in the style element.
    • Wrap <script> Content Into CDATA wraps all of the text inside scripts to prevent GoLive from mistakenly interpreting the special characters in the script element.
    • Put a Space Character In Front of "/>" converts empty tags such as <empty> to <empty /> instead of <empty/> (no blank space before the slash). This option helps make your document compatible with some browsers that can't handle end tags that have the correct syntax according to standards published by the W3C.
    • Remove <meta> Encoding Element removes the meta encoding element from the head section because the starting XML element contains encoding information.
    • Remove Encoding Information If It Is UTF-8 removes the encoding information if it is UTF-8, which is the default encoding for XML.
  3. Use the following options to set how you want GoLive to handle the conversion of the name attribute used in the following elements: a, form, img, and map. The conversion of the name attribute can cause compatibility problems in some browsers. HTML requires the name attribute for functionality, but the XHTML Strict DTD doesn't allow the name attribute in those elements.
    • Do Not Touch does not change the name attribute or its value. For example, <form name="formName"> remains <form name="formName"> after conversion.
    • Copy To Attribute "ID" copies the name attribute and its value to an ID attribute. For example, <form name="formName"> becomes <form name="formName" ID="formName"> after conversion.
    • Convert To Attribute "ID" converts the name attribute to an ID attribute. For example, <form name="formName"> becomes <form ID="formName"> after conversion.

    Note: If you select the Do Not Touch option or the Copy To Attribute "ID" option and your document has an XHTML Strict doctype, the Syntax Checker reports an error on the name attribute, but the document works correctly in a browser. If you select the Convert To Attribute "ID" option, and your document has an XHTML Strict doctype, the Syntax Checker doesn't report an error, but the document might not work correctly in a browser.

  4. Click OK.

To convert the doctype of a document from XHTML to HTML:

    In the Layout Editor, choose Markup from the document window menu, and then choose Convert to HTML.