Doctype Declarations

Developers can set the "document type declaration" or "doctype" of their Logi applications. Though it appears as the very first thing in an HTML/XHTML page, the doctype is not an HTML tag; instead it's an instruction to the web browser that identifies the version of the markup language the page is written in. This topic discusses the doctype options in Logi products.


 

About Doctypes

The HTML standards recognize a "document type declaration" (or "doctype") which is an instruction to the web browser that indicates which version of the markup language the page is written in. The doctype is a key component of standards-compliant web pages. Doctype tells modern browsers how they should apply HTML and CSS standards in rendering a page. These include more recent versions of Firefox, Chrome, Internet Explorer, Opera, and Safari. The doctype may include a URL reference to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that browsers can render the content correctly. If an invalid, or no, doctype is specified in an HTML page, browsers go into "quirks" mode, where they each handle the markup in different and, possibly, outdated ways.   


In Logi Studio, as shown above, the doctype is configured using the Doctype Declaration attribute of the General element in the _Settings definition. Five options are available using the pull-down selection list. HTML5 is the default value if no DocType Declaration value is selected or entered. If None is selected, no doctype instruction is added to the HTML pages generated by the Logi Server Engine. The other four options are discussed individually in the following sections.

Back to top

 

HTML5

When this option is selected for the Doctype Declaration attribute, the following is placed at the beginning of the generated HTML page: <!DOCTYPE HTML> This declares the document to be HTML5, which is not based on SGML and therefore does not require a reference to a DTD like other doctype declarations. It's the fifth revision of the HTML standard and its core aims have been to improve the language, adding support for the latest multimedia content, while keeping code easily readable by humans and consistently understood by computers and devices. HTML5 is intended to subsume not only HTML 4, but also XHTML 1 and DOM Level 2 HTML.

Back to top

 

XHTML Strict

When this option is selected for the Doctype Declaration attribute, the following is placed at the beginning of the generated HTML page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> This declares the document to be the XML version of HTML 4.01 Strict. This is a trimmed-down version of HTML 4.01 that emphasizes structure over presentation. Deprecated elements (such as Font) and attributes (including most presentational attributes), frames, and link targets are not allowed in HTML 4 Strict. Style can be applied only through style sheets. By writing to HTML 4 Strict, developers can achieve accessible, structurally-rich reports that easily adapt to style sheets and different browsing situations. However, HTML 4 Strict documents may look bland on very old browsers that lack support for style sheets.

Back to top

 

XHTML Transitional

When this option is selected for the Doctype Declaration attribute, the following is placed at the beginning of the generated HTML page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> This declares the document to be the XML version of HTML 4.01 Transitional. HTML 4 Transitional includes all of the elements and attributes of HTML 4 Strict and adds presentational attributes, deprecated elements, and link targets. For example, style tags can be included right in the HTML.

Back to top

 

XHTML Frameset

When the Doctype Declaration attribute value is left blank, this is the default option. When this option is in effect or selected, the following is placed at the beginning of the generated HTML page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> This declares the document to be the XML version of HTML 4.01 Frameset. HTML 4 Frameset includes all of the elements and attributes of HTML 4 Transitional and adds support for HTML frames. This is the most "generous" doctype and supports the most features in an HTML document.

Back to top

 

What's the Impact?

So, how does the choice of a particular doctype impact a Logi application? It can have quite an impact. XHTML Frameset provides a "loose" standard that encompasses everything, and the HTML generated by the Logi Server Engine did not generally cause any DTD-related problems. The default option, HTML5, may result in significant rendering differences in different browsers. And, if you select None, meaning use no doctype, you will almost certainly see presentation (CSS) differences between browsers. Things won't always be aligned correctly, and style may not be applied where or how you expect it, with the most problems occurring in Internet Explorer. And, in complimentary action, if you are seeing differences in the way different browsers present your report pages, the use of a doctype may fix that.

 You should be aware that, when you upgrade an application to Logi v12, and then open and edit legacy report definitions, Studio will automatically insert the default doctype, HTML5, depending on Logi version, into the definitions. This will often cause CSS to work differently and the resulting reports may look different. Developers who don't want to tweak their reports to "correct" these effects, can set the doctype to None in order to return the reports to their original appearance. Prior to HTML5, standards evangelists called for developers to use the XHTML Strict doctype whenever possible. This "tight" standard requires that you code everything very correctly. For example, if you use Event Handler with Action.Javascript or Action.Link and Target.Link elements (earlier versions) in your Logi app, and add Javascript, you must use the correct case-sensitive spelling for any Javascript functions there. This means "getElementById()" will work, but "GetElementByID()" will not. Your choice of doctype will also affect any HTML documents that you choose to embed in your Logi application. In this case, because the HTML is not being generated by the Log Server Engine, you need to take care to ensure that the coding is compliant with the doctype you've selected. For example, if your embedded HTML document includes the <font> tag and you select the Strict doctype, the tag will be ignored because that doctype does not support presentation-related tags within the HTML. If you are new to HTML5 and wish to see which of its features are available with which browsers, see this website: http://www.CanIUse.com.

Back to top