CINXE.COM
Document type definition - Wikipedia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>Document type definition - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"ac5a921f-968d-493a-a5b0-9cc86ff7dfa3","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Document_type_definition","wgTitle":"Document type definition","wgCurRevisionId":1212673118,"wgRevisionId":1212673118,"wgArticleId":8537,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Articles with short description","Short description matches Wikidata","Articles containing potentially dated statements from 2009","All articles containing potentially dated statements","All articles with unsourced statements","Articles with unsourced statements from February 2011","Articles with unsourced statements from November 2008","SGML","XML"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName": "Document_type_definition","wgRelevantArticleId":8537,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgRedirectedFrom":"Document_Type_Definition","wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":40000,"wgInternalRedirectTargetUrl":"/wiki/Document_type_definition","wgRelatedArticlesCompat":[],"wgCentralAuthMobileDomain":false,"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false, "wgWikibaseItemId":"Q212327","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["mediawiki.action.view.redirect","ext.cite.ux-enhancements","ext.pygments.view","site","mediawiki.page.ready","mediawiki.toc", "skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.4"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="Document type definition - Wikipedia"> <meta property="og:type" content="website"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/Document_type_definition"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=Document_type_definition&action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/Document_type_definition"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-Document_type_definition rootpage-Document_type_definition skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=Document+type+definition" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=Document+type+definition" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=Document+type+definition" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=Document+type+definition" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Associating_DTDs_with_documents" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Associating_DTDs_with_documents"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Associating DTDs with documents</span> </div> </a> <button aria-controls="toc-Associating_DTDs_with_documents-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Associating DTDs with documents subsection</span> </button> <ul id="toc-Associating_DTDs_with_documents-sublist" class="vector-toc-list"> <li id="toc-Examples" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Examples"> <div class="vector-toc-text"> <span class="vector-toc-numb">1.1</span> <span>Examples</span> </div> </a> <ul id="toc-Examples-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Markup_declarations" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Markup_declarations"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Markup declarations</span> </div> </a> <button aria-controls="toc-Markup_declarations-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Markup declarations subsection</span> </button> <ul id="toc-Markup_declarations-sublist" class="vector-toc-list"> <li id="toc-Element_type_declarations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Element_type_declarations"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.1</span> <span>Element type declarations</span> </div> </a> <ul id="toc-Element_type_declarations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Attribute_list_declarations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Attribute_list_declarations"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.2</span> <span>Attribute list declarations</span> </div> </a> <ul id="toc-Attribute_list_declarations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Entity_declarations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Entity_declarations"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.3</span> <span>Entity declarations</span> </div> </a> <ul id="toc-Entity_declarations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Notation_declarations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Notation_declarations"> <div class="vector-toc-text"> <span class="vector-toc-numb">2.4</span> <span>Notation declarations</span> </div> </a> <ul id="toc-Notation_declarations-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-XML_DTDs_and_schema_validation" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#XML_DTDs_and_schema_validation"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>XML DTDs and schema validation</span> </div> </a> <ul id="toc-XML_DTDs_and_schema_validation-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-XML_DTD_schema_example" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#XML_DTD_schema_example"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>XML DTD schema example</span> </div> </a> <ul id="toc-XML_DTD_schema_example-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Alternatives" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Alternatives"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Alternatives</span> </div> </a> <ul id="toc-Alternatives-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Security" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Security"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>Security</span> </div> </a> <ul id="toc-Security-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-External_links" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#External_links"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>External links</span> </div> </a> <ul id="toc-External_links-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">Document type definition</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 30 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-30" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">30 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%AA%D8%B9%D8%B1%D9%8A%D9%81_%D9%86%D9%88%D8%B9_%D8%A7%D9%84%D9%85%D8%B3%D8%AA%D9%86%D8%AF" title="تعريف نوع المستند – Arabic" lang="ar" hreflang="ar" data-title="تعريف نوع المستند" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Catalan" lang="ca" hreflang="ca" data-title="Document Type Definition" data-language-autonym="Català" data-language-local-name="Catalan" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Czech" lang="cs" hreflang="cs" data-title="Document Type Definition" data-language-autonym="Čeština" data-language-local-name="Czech" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Dokumenttypdefinition" title="Dokumenttypdefinition – German" lang="de" hreflang="de" data-title="Dokumenttypdefinition" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-et mw-list-item"><a href="https://et.wikipedia.org/wiki/Dokumendi_t%C3%BC%C3%BCbi_definitsioon" title="Dokumendi tüübi definitsioon – Estonian" lang="et" hreflang="et" data-title="Dokumendi tüübi definitsioon" data-language-autonym="Eesti" data-language-local-name="Estonian" class="interlanguage-link-target"><span>Eesti</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Definici%C3%B3n_de_tipo_de_documento" title="Definición de tipo de documento – Spanish" lang="es" hreflang="es" data-title="Definición de tipo de documento" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-eo mw-list-item"><a href="https://eo.wikipedia.org/wiki/Dokumento-Speco-Difino" title="Dokumento-Speco-Difino – Esperanto" lang="eo" hreflang="eo" data-title="Dokumento-Speco-Difino" data-language-autonym="Esperanto" data-language-local-name="Esperanto" class="interlanguage-link-target"><span>Esperanto</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%AA%D8%B9%D8%B1%DB%8C%D9%81_%D9%86%D9%88%D8%B9_%D8%B3%D9%86%D8%AF" title="تعریف نوع سند – Persian" lang="fa" hreflang="fa" data-title="تعریف نوع سند" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Document_type_definition" title="Document type definition – French" lang="fr" hreflang="fr" data-title="Document type definition" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EB%AC%B8%EC%84%9C_%ED%98%95%EC%8B%9D_%EC%A0%95%EC%9D%98" title="문서 형식 정의 – Korean" lang="ko" hreflang="ko" data-title="문서 형식 정의" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-hr mw-list-item"><a href="https://hr.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Croatian" lang="hr" hreflang="hr" data-title="Document Type Definition" data-language-autonym="Hrvatski" data-language-local-name="Croatian" class="interlanguage-link-target"><span>Hrvatski</span></a></li><li class="interlanguage-link interwiki-ia mw-list-item"><a href="https://ia.wikipedia.org/wiki/DTD" title="DTD – Interlingua" lang="ia" hreflang="ia" data-title="DTD" data-language-autonym="Interlingua" data-language-local-name="Interlingua" class="interlanguage-link-target"><span>Interlingua</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Italian" lang="it" hreflang="it" data-title="Document Type Definition" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Hebrew" lang="he" hreflang="he" data-title="Document Type Definition" data-language-autonym="עברית" data-language-local-name="Hebrew" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-hu mw-list-item"><a href="https://hu.wikipedia.org/wiki/Dokumentumt%C3%ADpus-defin%C3%ADci%C3%B3" title="Dokumentumtípus-definíció – Hungarian" lang="hu" hreflang="hu" data-title="Dokumentumtípus-definíció" data-language-autonym="Magyar" data-language-local-name="Hungarian" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-mk mw-list-item"><a href="https://mk.wikipedia.org/wiki/DTD" title="DTD – Macedonian" lang="mk" hreflang="mk" data-title="DTD" data-language-autonym="Македонски" data-language-local-name="Macedonian" class="interlanguage-link-target"><span>Македонски</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Document_type_definition" title="Document type definition – Dutch" lang="nl" hreflang="nl" data-title="Document type definition" data-language-autonym="Nederlands" data-language-local-name="Dutch" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Japanese" lang="ja" hreflang="ja" data-title="Document Type Definition" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Norwegian Bokmål" lang="nb" hreflang="nb" data-title="Document Type Definition" data-language-autonym="Norsk bokmål" data-language-local-name="Norwegian Bokmål" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-nn mw-list-item"><a href="https://nn.wikipedia.org/wiki/Dokumenttypedefinisjon" title="Dokumenttypedefinisjon – Norwegian Nynorsk" lang="nn" hreflang="nn" data-title="Dokumenttypedefinisjon" data-language-autonym="Norsk nynorsk" data-language-local-name="Norwegian Nynorsk" class="interlanguage-link-target"><span>Norsk nynorsk</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Polish" lang="pl" hreflang="pl" data-title="Document Type Definition" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Defini%C3%A7%C3%A3o_de_Tipo_de_Documento" title="Definição de Tipo de Documento – Portuguese" lang="pt" hreflang="pt" data-title="Definição de Tipo de Documento" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/DTD" title="DTD – Russian" lang="ru" hreflang="ru" data-title="DTD" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-sk mw-list-item"><a href="https://sk.wikipedia.org/wiki/Defin%C3%ADcia_typu_dokumentu" title="Definícia typu dokumentu – Slovak" lang="sk" hreflang="sk" data-title="Definícia typu dokumentu" data-language-autonym="Slovenčina" data-language-local-name="Slovak" class="interlanguage-link-target"><span>Slovenčina</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%94%D0%B5%D1%84%D0%B8%D0%BD%D0%B8%D1%86%D0%B8%D1%98%D0%B0_%D1%82%D0%B8%D0%BF%D0%B0_%D0%B4%D0%BE%D0%BA%D1%83%D0%BC%D0%B5%D0%BD%D1%82%D0%B0" title="Дефиниција типа документа – Serbian" lang="sr" hreflang="sr" data-title="Дефиниција типа документа" data-language-autonym="Српски / srpski" data-language-local-name="Serbian" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/DTD" title="DTD – Finnish" lang="fi" hreflang="fi" data-title="DTD" data-language-autonym="Suomi" data-language-local-name="Finnish" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-sv mw-list-item"><a href="https://sv.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Swedish" lang="sv" hreflang="sv" data-title="Document Type Definition" data-language-autonym="Svenska" data-language-local-name="Swedish" class="interlanguage-link-target"><span>Svenska</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/DTD" title="DTD – Turkish" lang="tr" hreflang="tr" data-title="DTD" data-language-autonym="Türkçe" data-language-local-name="Turkish" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/Document_Type_Definition" title="Document Type Definition – Ukrainian" lang="uk" hreflang="uk" data-title="Document Type Definition" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E6%96%87%E6%A1%A3%E7%B1%BB%E5%9E%8B%E5%AE%9A%E4%B9%89" title="文档类型定义 – Chinese" lang="zh" hreflang="zh" data-title="文档类型定义" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q212327#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Document_type_definition" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:Document_type_definition" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/Document_type_definition"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Document_type_definition&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Document_type_definition&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/Document_type_definition"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Document_type_definition&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Document_type_definition&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/Document_type_definition" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/Document_type_definition" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Document_type_definition&oldid=1212673118" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Document_type_definition&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=Document_type_definition&id=1212673118&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDocument_type_definition"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDocument_type_definition"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=Document_type_definition&action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Document_type_definition&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q212327" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"><span class="mw-redirectedfrom">(Redirected from <a href="/w/index.php?title=Document_Type_Definition&redirect=no" class="mw-redirect" title="Document Type Definition">Document Type Definition</a>)</span></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Set of markup declarations that define a document type for an SGML-family markup language</div><p>A <b>document type definition</b> (<b>DTD</b>) is a specification file that contains set of <i>markup declarations</i> that define a <i>document type</i> for an <a href="/wiki/SGML" class="mw-redirect" title="SGML">SGML</a>-family <a href="/wiki/Markup_language" title="Markup language">markup language</a> (<a href="/wiki/IBM_Generalized_Markup_Language" title="IBM Generalized Markup Language">GML</a>, <a href="/wiki/SGML" class="mw-redirect" title="SGML">SGML</a>, <a href="/wiki/XML" title="XML">XML</a>, <a href="/wiki/HTML" title="HTML">HTML</a>). The DTD specification file can be used to validate documents. </p><p>A DTD defines the valid building blocks of an XML document. It defines the document structure with a list of validated elements and attributes. A DTD can be declared inline inside an XML document, or as an external reference.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> </p><p>A namespace-aware version of DTDs is being developed as Part 9 of ISO <a href="/wiki/DSDL" class="mw-redirect" title="DSDL">DSDL</a>. DTDs persist in applications that need special publishing characters, such as the <a href="/wiki/List_of_XML_and_HTML_character_entity_references" title="List of XML and HTML character entity references">XML and HTML Character Entity References</a>, which derive from larger sets defined as part of the <a href="/wiki/SGML" class="mw-redirect" title="SGML">ISO SGML standard</a> effort. <a href="/wiki/XML" title="XML">XML</a> uses a subset of <a href="/wiki/SGML" class="mw-redirect" title="SGML">SGML</a> DTD. </p><p>As of 2009<sup class="plainlinks noexcerpt noprint asof-tag update" style="display:none;"><a class="external text" href="https://en.wikipedia.org/w/index.php?title=Document_type_definition&action=edit">[update]</a></sup>, newer <a href="/wiki/XML_namespace" title="XML namespace">XML namespace</a>-aware <a href="/wiki/XML_schema" title="XML schema">schema languages</a> (such as <a href="/wiki/XML_Schema_(W3C)" title="XML Schema (W3C)">W3C XML Schema</a> and <a href="/wiki/RELAX_NG" title="RELAX NG">ISO RELAX NG</a>) have largely superseded DTDs as a better way to validate XML structure. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Associating_DTDs_with_documents">Associating DTDs with documents</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=1" title="Edit section: Associating DTDs with documents"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A DTD is associated with an XML or SGML document by means of a <a href="/wiki/Document_type_declaration" title="Document type declaration">document type declaration</a> (DOCTYPE). The DOCTYPE appears in the syntactic fragment <i>doctypedecl</i> near the start of an XML document.<sup id="cite_ref-W3C,_doctypedecl_2-0" class="reference"><a href="#cite_note-W3C,_doctypedecl-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> The declaration establishes that the document is an instance of the type defined by the referenced DTD. </p><p>DOCTYPEs make two sorts of declarations: </p> <ul><li>an optional <i>external subset</i></li> <li>an optional <i>internal subset</i>.</li></ul> <p>The declarations in the internal subset form part of the DOCTYPE in the document itself. The declarations in the external subset are located in a separate text file. The external subset may be referenced via a <i><a href="/wiki/Public_identifier" class="mw-redirect" title="Public identifier">public identifier</a></i> and/or a <i><a href="/wiki/System_identifier" class="mw-redirect" title="System identifier">system identifier</a></i>. Programs for reading documents may not be required to read the external subset. </p><p>Any valid SGML or XML document that references an <i>external subset</i> in its DTD, or whose body contains references to <i>parsed external entities</i> declared in its DTD (including those declared within its <i>internal subset</i>), may only be partially parsed but cannot be fully validated by <i>validating</i> SGML or XML parsers in their <i>standalone</i> mode (this means that these validating parsers do not attempt to retrieve these external entities, and their replacement text is not accessible). </p><p>However, such documents are still fully parsable in the <i>non</i>-standalone mode of validating parsers, which signals an error if it can not locate these external entities with their specified <a href="/wiki/Formal_Public_Identifier" title="Formal Public Identifier"><i>public identifier</i> (FPI)</a> or <i>system identifier</i> (a URI), or are inaccessible. (Notations declared in the DTD are also referencing external entities, but these unparsed entities are not needed for the validation of documents in the <i>standalone</i> mode of these parsers: the validation of all external entities referenced by notations is left to the application using the SGML or XML parser). Non-validating parsers <i>may</i> eventually attempt to locate these external entities in the <i>non</i>-standalone mode (by partially interpreting the DTD only to resolve their declared parsable entities), but do not validate the content model of these documents. </p> <div class="mw-heading mw-heading3"><h3 id="Examples">Examples</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=2" title="Edit section: Examples"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The following example of a DOCTYPE contains both public and system identifiers: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!DOCTYPE</span> <span class="nt">html</span> <span class="kc">PUBLIC</span> <span class="s2">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="s2">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="k">></span> </pre></div> <p>All HTML 4.01 documents conform to one of three SGML DTDs. The public identifiers of these DTDs are constant and are as follows: </p> <ul><li><code><a rel="nofollow" class="external text" href="http://www.w3.org/TR/html4/strict.dtd">-//W3C//DTD HTML 4.01//EN</a></code></li> <li><code><a rel="nofollow" class="external text" href="http://www.w3.org/TR/html4/loose.dtd">-//W3C//DTD HTML 4.01 Transitional//EN</a></code></li> <li><code><a rel="nofollow" class="external text" href="http://www.w3.org/TR/html4/frameset.dtd">-//W3C//DTD HTML 4.01 Frameset//EN</a></code></li></ul> <p>The system identifiers of these DTDs, if present in the DOCTYPE, are <a href="/wiki/Uniform_Resource_Identifier" title="Uniform Resource Identifier">URI references</a>. A system identifier usually points to a specific set of declarations in a resolvable location. SGML allows mapping public identifiers to system identifiers in <a href="/wiki/XML_Catalog" class="mw-redirect" title="XML Catalog">catalogs</a> that are optionally available to the URI resolvers used by document <a href="/wiki/Parsing" title="Parsing">parsing</a> software. </p><p>This DOCTYPE can only appear <i>after</i> the optional <a href="/wiki/XHTML#XML_declaration" title="XHTML">XML declaration</a>, and before the document body, if the document syntax conforms to XML. This includes <a href="/wiki/XHTML" title="XHTML">XHTML</a> documents: </p> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?xml version="1.0" encoding="utf-8"?></span> <span class="cp"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="cp">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></span> <span class="cm"><!-- the XHTML document body starts here--></span> <span class="nt"><html</span><span class="w"> </span><span class="na">xmlns=</span><span class="s">"http://www.w3.org/1999/xhtml"</span><span class="nt">></span> <span class="w"> </span>... <span class="nt"></html></span> </pre></div> <p>An additional internal subset can also be provided after the external subset: </p> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?xml version="1.0" encoding="utf-8"?></span> <span class="cp"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="cp">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [</span> <span class="cp"> <!-- an internal subset can be embedded here --></span> ]> <span class="cm"><!-- the XHTML document body starts here--></span> <span class="nt"><html</span><span class="w"> </span><span class="na">xmlns=</span><span class="s">"http://www.w3.org/1999/xhtml"</span><span class="nt">></span> <span class="w"> </span>... <span class="nt"></html></span> </pre></div> <p>Alternatively, only the internal subset may be provided: </p> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?xml version="1.0" encoding="utf-8"?></span> <span class="cp"><!DOCTYPE html [</span> <span class="cp"> <!-- an internal subset can be embedded here --></span> ]> <span class="cm"><!-- the XHTML document body starts here--></span> <span class="nt"><html</span><span class="w"> </span><span class="na">xmlns=</span><span class="s">"http://www.w3.org/1999/xhtml"</span><span class="nt">></span> <span class="w"> </span>... <span class="nt"></html></span> </pre></div> <p>Finally, the document type definition may include no subset at all; in that case, it just specifies that the document has a single top-level element (this is an implicit requirement for all valid XML and HTML documents, but not for document fragments or for all SGML documents, whose top-level elements may be different from the implied root element), and it indicates the type name of the root element: </p> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?xml version="1.0" encoding="utf-8"?></span> <span class="cp"><!DOCTYPE html></span> <span class="cm"><!-- the XHTML document body starts here--></span> <span class="nt"><html</span><span class="w"> </span><span class="na">xmlns=</span><span class="s">"http://www.w3.org/1999/xhtml"</span><span class="nt">></span> <span class="w"> </span>... <span class="nt"></html></span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="Markup_declarations">Markup declarations</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=3" title="Edit section: Markup declarations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>DTDs describe the structure of a class of documents via element and attribute-list declarations. Element declarations name the allowable set of elements within the document, and specify whether and how declared elements and runs of character data may be contained within each element. Attribute-list declarations name the allowable set of attributes for each declared element, including the <a href="/wiki/Data_type" title="Data type">type</a> of each attribute value, if not an explicit set of valid values. </p><p>DTD markup declarations declare which <a href="#Element_type_declarations">element types</a>, <a href="#Attribute_list_declarations">attribute lists</a>, <a href="#Entity_declarations">entities</a>, and <a href="#Notation_declarations">notations</a> are allowed in the structure of the corresponding class of XML documents.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Element_type_declarations">Element type declarations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=4" title="Edit section: Element type declarations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An element type declaration defines an element and its possible content. A valid XML document contains only elements that are defined in the DTD. </p><p>Various keywords and characters specify an element's content: </p> <ul><li><code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="err">EMPTY</span></code> for specifying that the defined element allows no content, i.e., it cannot have any children elements, not even text elements (if there are whitespaces, they are ignored);</li> <li><code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="err">ANY</span></code> for specifying that the defined element allows any content, without restriction, i.e., that it may have any number (including none) and type of children elements (including text elements);</li> <li>or an expression, specifying the only elements allowed as direct children in the content of the defined element; this content can be either: <ul><li>a <b>mixed content</b>, which means that the content may include at least one text element and zero or more named elements, but their order and number of occurrences cannot be restricted; this can be: <ul><li><code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">(</span> <span class="err">#PCDATA</span> <span class="o">)</span></code>: historically meaning <i>parsed character data</i>, this means that only one text element is allowed in the content (no quantifier is allowed);</li> <li><code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">(</span> <span class="err">#PCDATA</span> <span class="o">|</span> <span class="s1">''</span><span class="err">element</span> <span class="err">name</span><span class="s1">''</span> <span class="o">|</span> <span class="err">...</span> <span class="o">)*</span></code>: a limited choice (in an exclusive list between parentheses and separated by "<code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">|</span></code>" pipe characters and terminated by the required "<code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">*</span></code>" quantifier) of two or more child elements (including only text elements or the specified named elements) may be used in any order and number of occurrences in the content.</li></ul></li> <li>an <b>element content</b>, which means that there must be no text elements in the children elements of the content (all whitespaces encoded between child elements are then ignored, just like comments). Such element content is specified as <i>content particle</i> in a variant of <a href="/wiki/Backus%E2%80%93Naur_form" title="Backus–Naur form">Backus–Naur form</a> without terminal symbols and element names as non-terminal symbols. Element content consists of: <ul><li>a <b>content particle</b> can be either the name of an element declared in the DTD, or a <i>sequence list</i> or <i>choice list</i>. It may be followed by an optional <i>quantifier</i>. <ul><li>a <b>sequence list</b> means an ordered list (specified between parentheses and separated by a "<code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">,</span></code>" comma character) of one or more <i>content particles</i>: all the <i>content particles</i> must appear successively as direct children in the content of the defined element, at the specified position and relative order;</li> <li>a <b>choice list</b> means a mutually exclusive list (specified between parentheses and separated by a "<code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">|</span></code>" pipe character) of two or more <i>content particles</i>: only one of these <i>content particles</i> may appear in the content of the defined element at the same position.</li></ul></li> <li>A <b>quantifier</b> is a single character that immediately follows the specified item it applies to, to restrict the number of successive occurrences of these items at the specified position in the content of the element; it may be either: <ul><li><code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">+</span></code> for specifying that there must be one or more occurrences of the item — the effective content of each occurrence may be different;</li> <li><code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">*</span></code> for specifying that any number (zero or more) of occurrences is allowed — the item is optional and the effective content of each occurrence may be different;</li> <li><code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="o">?</span></code> for specifying that there must not be more than one occurrence — the item is optional;</li> <li>If there is no quantifier, the specified item must occur exactly one time at the specified position in the content of the element.</li></ul></li></ul></li></ul></li></ul> <p>For example: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!ELEMENT</span> <span class="nt">html</span> <span class="o">(</span><span class="nt">head</span><span class="o">,</span> <span class="nt">body</span><span class="o">)</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">p</span> <span class="o">(</span><span class="kc">#PCDATA</span> <span class="o">|</span> <span class="nt">p</span> <span class="o">|</span> <span class="nt">ul</span> <span class="o">|</span> <span class="nt">dl</span> <span class="o">|</span> <span class="nt">table</span> <span class="o">|</span> <span class="nt">h1</span><span class="o">|</span><span class="nt">h2</span><span class="o">|</span><span class="nt">h3</span><span class="o">)*</span><span class="k">></span> </pre></div> <p>Element type declarations are ignored by <i>non-validating</i> SGML and XML parsers (in which cases, any elements are accepted in any order, and in any number of occurrences in the parsed document), but these declarations are still checked for form and validity. </p> <div class="mw-heading mw-heading3"><h3 id="Attribute_list_declarations">Attribute list declarations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=5" title="Edit section: Attribute list declarations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An attribute list specifies for a given element type the list of all possible attribute associated with that type. For each possible attribute, it contains: </p> <ul><li>the declared name of the attribute,</li> <li>its data type (or an enumeration of its possible values),</li> <li>and its default value.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup></li></ul> <p>For example: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!ATTLIST</span> <span class="nt">img</span> <span class="na">src</span> <span class="kc">CDATA</span> <span class="kc">#REQUIRED</span> <span class="na">id</span> <span class="kc">ID</span> <span class="kc">#IMPLIED</span> <span class="na">sort</span> <span class="kc">CDATA</span> <span class="kc">#FIXED</span> <span class="s2">"true"</span> <span class="na">print</span> <span class="o">(</span><span class="na">yes</span> <span class="o">|</span> <span class="na">no</span><span class="o">)</span> <span class="s2">"yes"</span> <span class="k">></span> </pre></div> <p>Here are some attribute types supported by both SGML and XML: </p> <dl><dt><code>CDATA</code></dt> <dd>this type means <i>characters data</i> and indicates that the effective value of the attribute can be any textual value, unless the attribute is specified as fixed (the comments in the DTD may further document values that are effectively accepted, but the DTD syntax does not allow such precise specification);</dd> <dt><code>ID</code></dt> <dd>the effective value of the attribute must be a valid identifier, and it is used to define and anchor to the current element the target of references using this defined identifier (including as document <a href="/wiki/Fragment_identifier" class="mw-redirect" title="Fragment identifier">fragment identifiers</a> that may be specified at end of an URI after a "#" sign); it is an error if distinct elements in the same document are defining the same identifier; the uniqueness constraint also implies that the identifier itself carries no other semantics and that identifiers must be treated as opaque in applications; XML also predefines the standard pseudo-attribute "<code>xml:id</code>" with this type, without needing any declaration in the DTD, so the uniqueness constraint also applies to these defined identifiers when they are specified anywhere in a XML document.</dd> <dt><code>IDREF</code> or <code>IDREFS</code></dt> <dd>the effective value of the attribute can only be a valid identifier (or a space-separated list of such identifiers) and must be referencing the unique element defined in the document with an attribute declared with the type <code>ID</code> in the DTD (or the unique element defined in an XML document with a pseudo-attribute "<code>xml:id</code>") and whose effective value is the same identifier;</dd> <dt><code>NMTOKEN</code> or <code>NMTOKENS</code></dt> <dd>the effective value of the attribute can only be a valid name token (or a spaced-separated list of such name tokens), but it is not restricted to a unique identifier within the document; this name may carry supplementary and application-dependent semantics and may require additional naming constraints, but this is out of scope of the DTD;</dd> <dt><code>ENTITY</code> or <code>ENTITIES</code></dt> <dd>the effective value of the attribute can only be the name of an unparsed external entity (or a space-separated list of such names), which must also be declared in the document type declaration; this type is not supported in HTML parsers, but is valid in SGML and XML 1.0 or 1.1 (including XHTML and SVG);</dd> <dt><code>(<i>value1</i>|...)</code></dt> <dd>the effective value of the attribute can only be one of the enumerated list (specified between parentheses and separated by a "<code>|</code>" pipe character) of textual values, where each value in the enumeration is possibly specified between <code>'</code>single<code>'</code> or <code>"</code>double<code>"</code> quotation marks if it's not a simple name token;</dd> <dt><code>NOTATION (<i>notation1</i>|...)</code></dt> <dd>the effective value of the attribute can only be any one of the enumerated list (specified between parentheses and separated by a "<code>|</code>" pipe character) of notation names, where each notation name in the enumeration must also be declared in the document type declaration; this type is not supported in HTML parsers, but is valid in SGML and XML 1.0 or 1.1 (including XHTML and SVG).</dd></dl> <p>A default value can define whether an attribute must occur (<code>#REQUIRED</code>) or not (<code>#IMPLIED</code>), or whether it has a fixed value (<code>#FIXED</code>), or which value should be used as a default value ("…") in case the given attribute is left out in an XML tag. </p><p>Attribute list declarations are ignored by <i>non-validating</i> SGML and XML parsers (in which cases any attribute is accepted within all elements of the parsed document), but these declarations are still checked for well-formedness and validity. </p> <div class="mw-heading mw-heading3"><h3 id="Entity_declarations">Entity declarations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=6" title="Edit section: Entity declarations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An entity is similar to a <a href="/wiki/Macro_(computer_science)" title="Macro (computer science)">macro</a>. The entity declaration assigns it a value that is retained throughout the document. A common use is to have a name more recognizable than a numeric character reference for an unfamiliar character.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> Entities help to improve legibility of an XML text. In general, there are two types: internal and external. </p> <ul><li><b>Internal (parsed) entities</b> are associating a name with any arbitrary textual content defined in their declaration (which may be in the <i>internal subset</i> or in the <i>external subset</i> of the DTD declared in the document). When a named entity reference is then encountered in the rest of the document (including in the rest of the DTD), and if this entity name has effectively been defined as a parsed entity, the reference itself is replaced immediately by the textual content defined in the parsed entity, and the parsing continues within this replacement text. <ul><li><b>Predefined named character entities</b> are similar to internal entities: 5 of them however are treated specially in all SGML, HTML and XML parsers. These entities are a bit different from normal parsed entities, because when a named character entity reference is encountered in the document, the reference is also replaced immediately by the character content defined in the entity, but the parsing continues <b>after</b> the replacement text, which is immediately inserted literally in the currently parsed token (if such character is permitted in the textual value of that token). This allows some characters that are needed for the core syntax of HTML or XML themselves to be escaped from their special syntactic role (notably "&" which is reserved for beginning entity references, "<" or ">" which delimit the markup tags, and "double" or 'single' quotation marks, which delimit the values of attributes and entity definitions). Predefined character entities also include numeric character references that are handled the same way and can also be used to escape the characters they represent, or to bypass limitations in the character repertoire supported by the document encoding.</li> <li>In basic profiles for SGML or in HTML documents, the declaration of internal entities is not possible (because external DTD subsets are not retrieved, and internal DTD subsets are not supported in these basic profiles).</li> <li>Instead, HTML standards predefine a large set of several hundred named character entities, which can still be handled as standard parsed entities defined in the DTD used by the parser.</li></ul></li> <li><b>External entities</b> refer to external storage objects. They are just declared by a unique name in the document, and defined with a public identifier (an FPI) and/or a system identifier (interpreted as an <a href="/wiki/URI" class="mw-redirect" title="URI">URI</a>) specifying where the source of their content. They exist in fact in two variants: <ul><li><b>parsed external entities</b> (most often defined with a SYSTEM identifier indicating the URI of their content) that are <i>not</i> associated in their definition to a named annotation, in which case validating XML or SGML parsers retrieve their contents and parse them as if they were declared as internal entities (the external entity containing their effective replacement text);</li> <li><b>unparsed external entities</b> that are defined and associated with an annotation name, in which case they are treated as opaque references and signaled as such to the application using the SGML or XML parser: their interpretation, retrieval and parsing is left to the application, according to the types of annotations it supports (see the next section about annotations and for examples of unparsed external entities).</li> <li>External entities are not supported in basic profiles for SGML or in HTML documents, but are valid in full implementations of SGML and in XML 1.0 or 1.1 (including XHTML and SVG, even if they are not strictly needed in those document types).</li></ul></li></ul> <p>An example of internal entity declarations (here in an internal DTD subset of an SGML document) is: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!DOCTYPE</span> <span class="nt">sgml</span> <span class="k">[</span> <span class="k"><!ELEMENT</span> <span class="nt">sgml</span> <span class="kc">ANY</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">std</span> <span class="s2">"standard SGML"</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">signature</span> <span class="s2">" &#x2014; &author;."</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">question</span> <span class="s2">"Why couldn&#x2019;t I publish my books directly in %std;?"</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">author</span> <span class="s2">"William Shakespeare"</span><span class="k">></span> <span class="k">]></span> </pre></div> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="nt"><sgml></span><span class="ni">&question;&signature;</span><span class="nt"></sgml></span> </pre></div> <p>Internal entities may be defined in any order, as long as they are not referenced and parsed in the DTD or in the body of the document, in their order of parsing: it is valid to include a reference to a still undefined entity within the content of a parsed entity, but it is invalid to include anywhere else any named entity reference before this entity has been fully defined, including all other internal entities referenced in its defined content (this also prevents circular or recursive definitions of internal entities). This document is parsed as if it was: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!DOCTYPE</span> <span class="nt">sgml</span> <span class="k">[</span> <span class="k"><!ELEMENT</span> <span class="nt">sgml</span> <span class="kc">ANY</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">std</span> <span class="s2">"standard SGML"</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">signature</span> <span class="s2">" — &author;."</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">question</span> <span class="s2">"Why couldn’t I publish my books directly in standard SGML?"</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">%</span> <span class="ni">author</span> <span class="s2">"William Shakespeare"</span><span class="k">></span> <span class="k">]></span> </pre></div> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="nt"><sgml></span>Why<span class="w"> </span>couldn’t<span class="w"> </span>I<span class="w"> </span>publish<span class="w"> </span>my<span class="w"> </span>books<span class="w"> </span>directly<span class="w"> </span>in<span class="w"> </span>standard<span class="w"> </span>SGML?<span class="w"> </span>—<span class="w"> </span>William<span class="w"> </span>Shakespeare.<span class="nt"></sgml></span> </pre></div> <p>Reference to the "author" internal entity is not substituted in the replacement text of the "signature" internal entity. Instead, it is replaced only when the "signature" entity reference is parsed within the content of the "sgml" element, but only by validating parsers (non-validating parsers do not substitute entity references occurring within contents of element or within attribute values, in the body of the document. </p><p>This is possible because the replacement text specified in the internal entity definitions permits a distinction between <b>parameter</b> entity references (that are introduced by the "%" character and whose replacement applies to the parsed DTD contents) and <b>general</b> entity references (that are introduced by the "&" character and whose replacement is delayed until they are effectively parsed and validated). The "%" character for introducing parameter entity references in the DTD loses its special role outside the DTD and it becomes a literal character. </p><p>However, the references to predefined character entities are substituted wherever they occur, without needing a validating parser (they are only introduced by the "&" character). </p> <div class="mw-heading mw-heading3"><h3 id="Notation_declarations">Notation declarations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=7" title="Edit section: Notation declarations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Notations are used in SGML or XML. They provide a complete reference to unparsed external entities whose interpretation is left to the application (which interprets them directly or retrieves the external entity themselves), by assigning them a simple name, which is usable in the body of the document. For example, notations may be used to reference non-XML data in an XML 1.1 document. For example, to annotate SVG images to associate them with a specific renderer: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!NOTATION</span> <span class="nt">type-image-svg</span> <span class="kc">SYSTEM</span> <span class="s2">"image/svg"</span><span class="k">></span> </pre></div> <p>This declares the <a href="/wiki/Media_Hype" class="mw-redirect" title="Media Hype">TEXT</a> of external images with this type, and associates it with a notation name "type-image-svg". However, notation names usually follow a naming convention that is specific to the application generating or using the notation: notations are interpreted as additional meta-data whose effective content is an external entity and either a PUBLIC FPI, registered in the catalogs used by XML or SGML parsers, or a SYSTEM URI, whose interpretation is application dependent (here a MIME type, interpreted as a relative URI, but it could be an absolute URI to a specific renderer, or a URN indicating an OS-specific object identifier such as a UUID). </p><p>The declared notation name must be unique within all the document type declaration, i.e. in the external subset as well as the internal subset, at least for conformance with XML.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> </p><p>Notations can be associated to unparsed external entities included in the body of the SGML or XML document. The <code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="kc">PUBLIC</span></code> or <code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="kc">SYSTEM</span></code> parameter of these external entities specifies the FPI and/or the URI where the unparsed data of the external entity is located, and the additional <code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="err">NDATA</span></code> parameter of these defined entities specifies the additional notation (i.e., effectively the MIME type here). For example: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!DOCTYPE</span> <span class="nt">sgml</span> <span class="k">[</span> <span class="k"><!ELEMENT</span> <span class="nt">sgml</span> <span class="o">(</span><span class="nt">img</span><span class="o">)*</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">img</span> <span class="kc">EMPTY</span><span class="k">></span> <span class="k"><!ATTLIST</span> <span class="nt">img</span> <span class="na">data</span> <span class="kc">ENTITY</span> <span class="kc">#IMPLIED</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">example1SVG</span> <span class="kc">SYSTEM</span> <span class="s2">"example1.svg"</span> <span class="kc">NDATA</span> <span class="ni">example1SVG-rdf</span><span class="k">></span> <span class="k"><!NOTATION</span> <span class="nt">example1SVG-rdf</span> <span class="kc">SYSTEM</span> <span class="s2">"example1.svg.rdf"</span><span class="k">></span> <span class="k">]></span> </pre></div> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="nt"><sgml></span> <span class="w"> </span><span class="nt"><img</span><span class="w"> </span><span class="na">data=</span><span class="s">"example1SVG"</span><span class="w"> </span><span class="nt">/></span> <span class="nt"></sgml></span> </pre></div> <p>Within the body of the SGML document, these referenced external entities (whose name is specified between "&" and ";") are <i>not</i> replaced like usual named entities (defined with a CDATA value), but are left as distinct unparsed tokens that may be used either as the value of an element attribute (like above) or within the element contents, provided that either the DTD allows such external entities in the declared content type of elements or in the declared type of attributes (here the <code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="err">ENTITY</span></code> type for the <code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="err">data</span></code> attribute), or the SGML parser is not validating the content. </p><p>Notations may also be associated directly to elements as additional meta-data, without associating them to another external entity, by giving their names as possible values of some additional attributes (also declared in the DTD within the <code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="k"><!ATTLIST</span> <span class="nt">...></span></code> declaration of the element). For example: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!DOCTYPE</span> <span class="nt">sgml</span> <span class="k">[</span> <span class="k"><!ELEMENT</span> <span class="nt">sgml</span> <span class="o">(</span><span class="nt">img</span><span class="o">)*</span><span class="k">></span> <span class="c"><!--</span> <span class="c"> the optional "type" attribute value can only be set to this notation.</span> <span class="c"> --></span> <span class="k"><!ATTLIST</span> <span class="nt">sgml</span> <span class="na">type</span> <span class="kc">NOTATION</span> <span class="o">(</span> <span class="na">type-vendor-specific</span> <span class="o">)</span> <span class="kc">#IMPLIED</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">img</span> <span class="kc">ANY</span><span class="k">></span> <span class="c"><!-- optional content can be only parsable SGML or XML data --></span> <span class="c"><!--</span> <span class="c"> The optional "title" attribute value must be parsable as text.</span> <span class="c"> The optional "data" attribute value is set to an unparsed external entity.</span> <span class="c"> The optional "type" attribute value can only be one of the two notations.</span> <span class="c"> --></span> <span class="k"><!ATTLIST</span> <span class="nt">img</span> <span class="na">title</span> <span class="kc">CDATA</span> <span class="kc">#IMPLIED</span> <span class="na">data</span> <span class="kc">ENTITY</span> <span class="kc">#IMPLIED</span> <span class="na">type</span> <span class="kc">NOTATION</span> <span class="o">(</span> <span class="na">type-image-svg</span> <span class="o">|</span> <span class="na">type-image-gif</span> <span class="o">)</span> <span class="kc">#IMPLIED</span><span class="k">></span> <span class="c"><!--</span> <span class="c"> Notations are referencing external entities and may be set in the "type" attributes above,</span> <span class="c"> or must be referenced by any defined external entities that cannot be parsed.</span> <span class="c"> --></span> <span class="k"><!NOTATION</span> <span class="nt">type-image-svg</span> <span class="kc">PUBLIC</span> <span class="s2">"-//W3C//DTD SVG 1.1//EN"</span> <span class="s2">"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"</span><span class="k">></span> <span class="k"><!NOTATION</span> <span class="nt">type-image-gif</span> <span class="kc">PUBLIC</span> <span class="s2">"image/gif"</span><span class="k">></span> <span class="k"><!NOTATION</span> <span class="nt">type-vendor-specific</span> <span class="kc">PUBLIC</span> <span class="s2">"application/VND.specific+sgml"</span><span class="k">></span> <span class="k"><!ENTITY</span> <span class="ni">example1SVGTitle</span> <span class="s2">"Title of example1.svg"</span><span class="k">></span> <span class="c"><!-- parsed internal entity --></span> <span class="k"><!ENTITY</span> <span class="ni">example1SVG</span> <span class="kc">SYSTEM</span> <span class="s2">"example1.svg"</span><span class="k">></span> <span class="c"><!-- parsed external entity --></span> <span class="k"><!ENTITY</span> <span class="ni">example1GIFTitle</span> <span class="s2">"Title of example1.gif"</span><span class="k">></span> <span class="c"><!-- parsed internal entity --></span> <span class="k"><!ENTITY</span> <span class="ni">example1GIF</span> <span class="kc">SYSTEM</span> <span class="s2">"example1.gif"</span> <span class="kc">NDATA</span> <span class="ni">type-image-gif</span><span class="k">></span> <span class="c"><!-- unparsed external entity --></span> <span class="k">]></span> </pre></div> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="nt"><sgml</span><span class="w"> </span><span class="na">type=</span><span class="s">"type-vendor-specific"</span><span class="nt">></span> <span class="w"> </span><span class="cm"><!-- an SVG image is parsable as valid SGML or XML text --></span> <span class="w"> </span><span class="nt"><img</span><span class="w"> </span><span class="na">title=</span><span class="s">"&example1SVGTitle;"</span><span class="w"> </span><span class="na">type=</span><span class="s">"type-image-svg"</span><span class="nt">></span><span class="ni">&example1SVG;</span><span class="nt"></img></span> <span class="w"> </span><span class="cm"><!-- it can also be referenced as an unparsed external entity --></span> <span class="w"> </span><span class="nt"><img</span><span class="w"> </span><span class="na">title=</span><span class="s">"&example1SVGTitle;"</span><span class="w"> </span><span class="na">data=</span><span class="s">"example1SVG"</span><span class="w"> </span><span class="nt">/></span> <span class="w"> </span><span class="cm"><!-- a GIF image is not parsable and can only be referenced as an external entity --></span> <span class="w"> </span><span class="nt"><img</span><span class="w"> </span><span class="na">title=</span><span class="s">"&example1GIFTitle;"</span><span class="w"> </span><span class="na">data=</span><span class="s">"example1GIF"</span><span class="w"> </span><span class="nt">/></span> <span class="nt"></sgml></span> </pre></div> <p>The example above shows a notation named "type-image-svg" that references the standard public FPI and the system identifier (the standard URI) of an SVG 1.1 document, instead of specifying just a system identifier as in the first example (which was a relative URI interpreted locally as a MIME type). This annotation is referenced directly within the unparsed "type" attribute of the "img" element, but its content is not retrieved. It also declares another notation for a vendor-specific application, to annotate the "sgml" root element in the document. In both cases, the declared notation named is used directly in a declared "type" attribute, whose content is specified in the DTD with the "NOTATION" attribute type (this "type" attribute is declared for the "sgml" element, as well as for the "img" element). </p><p>However, the "title" attribute of the "img" element specifies the internal entity "example1SVGTitle" whose declaration that does not define an annotation, so it is parsed by validating parsers and the entity replacement text is "Title of example1.svg". </p><p>The content of the "img" element references another external entity "example1SVG" whose declaration also does not define an notation, so it is also parsed by validating parsers and the entity replacement text is located by its defined SYSTEM identifier "example1.svg" (also interpreted as a relative URI). The effective content for the "img" element be the content of this second external resource. The difference with the GIF image, is that the SVG image is parsed within the SGML document, according to the declarations in the DTD, where the GIF image is just referenced as an opaque external object (which is not parsable with SGML) via its "data" attribute (whose value type is an opaque ENTITY). </p><p>Only one notation name may be specified in the value of ENTITY attributes (there is no support in SGML, XML 1.0 or XML 1.1 for multiple notation names in the same declared external ENTITY, so separate attributes are needed). However multiple external entities may be referenced (in a space-separated list of names) in attributes declared with type ENTITIES, and where each named external entity is also declared with its own notation). </p><p>Notations are also completely opaque for XML and SGML parsers, so they are not differentiated by the type of the external entity that they may reference (for these parsers they just have a unique name associated to a public identifier (an FPI) and/or a system identifier (a URI)). </p><p>Some applications (but not XML or SGML parsers themselves) also allow referencing notations indirectly by naming them in the <code class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><span class="s2">"URN:''name''"</span></code> value of a standard CDATA attribute, everywhere a URI can be specified. However this behaviour is application-specific, and requires that the application maintains a catalog of known URNs to resolve them into the notations that have been parsed in a standard SGML or XML parser. This use allows notations to be defined only in a DTD stored as an external entity and referenced only as the external subset of documents, and allows these documents to remain compatible with validating XML or SGML parsers that have no direct support for notations. </p><p>Notations are not used in HTML, or in basic profiles for XHTML and SVG, because: </p> <ul><li>All external entities used by these standard document types are referenced by simple attributes, declared with the CDATA type in their standard DTD (such as the "href" attribute of an anchor "a" element, or the "src" attribute of an image "img" element, whose values are interpreted as a URI, without needing any catalog of public identifiers, i.e., known FPI)</li> <li>All external entities for additional meta-data are referenced by either: <ul><li>Additional attributes (such as <i>type</i>, which indicates the MIME type of the external entity, or the <i>charset</i> attribute, which indicates its encoding)</li> <li>Additional elements (such as <i>link</i> or <i>meta</i> in HTML and XHTML) within their own attributes</li> <li>Standard pseudo-attributes in XML and XHTML (such as <i>xml:lang</i>, or <i>xmlns</i> and <i>xmlns:*</i> for namespace declarations).</li></ul></li></ul> <p>Even in validating SGML or XML 1.0 or XML 1.1 parsers, the external entities referenced by an FPI and/or URI in declared notations are not retrieved automatically by the parsers themselves. Instead, these parsers just provide to the application the parsed FPI and/or URI associated to the notations found in the parsed SGML or XML document, and with a facility for a dictionary containing all notation names declared in the DTD; these validating parsers also check the uniqueness of notation name declarations, and report a validation error if some notation names are used anywhere in the DTD or in the document body but not declared: </p> <ul><li>If the application can not use any notation (or if their FPI and/or URI are unknown or not supported in their local catalog), these notations may be either ignored silently by the application or the application could signal an error.</li> <li>Otherwise, the applications decide themselves how to interpret them, then if the external entities must be retrieved and then parsed separately.</li> <li>Applications may then signal an error, if such interpretation, retrieval or separate parsing fails.</li> <li>Unrecognized notations that may cause an application to signal an error should not block interpretation of the validated document using them.</li></ul> <div class="mw-heading mw-heading2"><h2 id="XML_DTDs_and_schema_validation">XML DTDs and schema validation</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=8" title="Edit section: XML DTDs and schema validation"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The XML DTD syntax is one of several <a href="/wiki/XML_schema" title="XML schema">XML schema</a> languages. However, many of the schema languages do not fully replace the XML DTD. Notably, the XML DTD allows defining entities and notations that have no direct equivalents in DTD-less XML (because internal entities and parsable external entities are not part of XML schema languages, and because other unparsed external entities and notations have no simple equivalent mappings in most XML schema languages). </p><p>Most XML schema languages are only replacements for element declarations and attribute list declarations, in such a way that it becomes possible to parse XML documents with <i>non-validating</i> XML parsers (if the only purpose of the external DTD subset was to define the schema). In addition, documents for these XML schema languages must be parsed separately, so validating the schema of XML documents in pure standalone mode is not really possible with these languages: the document type declaration remains necessary for at least identifying (with a <a href="/wiki/XML_Catalog" class="mw-redirect" title="XML Catalog">XML Catalog</a>) the schema used in the parsed XML document and that is validated in another language. </p><p>A common misconception holds that a <i>non-validating</i> XML parser does not have to read document type declarations, when in fact, the document type declarations must still be scanned for correct syntax as well as validity of declarations, and the parser must still parse all entity declarations in the <i>internal subset</i>, and substitute the replacement texts of internal entities occurring anywhere in the document type declaration or in the document body. </p><p>A <i>non-validating</i> parser may, however, elect not to read parsable <i>external entities</i> (including the <i>external subset</i>), and does not have to honor the content model restrictions defined in element declarations and in attribute list declarations. </p><p>If the XML document depends on parsable external entities (including the specified <i>external subset</i>, or parsable external entities declared in the <i>internal subset</i>), it should assert <code>standalone="no"</code> in its <a href="/w/index.php?title=XML_declaration&action=edit&redlink=1" class="new" title="XML declaration (page does not exist)">XML declaration</a>. The validating DTD may be identified by using <a href="/wiki/XML_Catalog" class="mw-redirect" title="XML Catalog">XML Catalogs</a> to retrieve its specified <i>external subset</i>. </p><p>In the example below, the XML document is declared with <code>standalone="no"</code> because it has an external subset in its document type declaration: </p> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?xml version="1.0" encoding="UTF-8" standalone="no"?></span> <span class="cp"><!DOCTYPE people_list SYSTEM "example.dtd"></span> <span class="nt"><people_list</span><span class="w"> </span><span class="nt">/></span> </pre></div> <p>If the XML document type declaration includes any SYSTEM identifier for the external subset, it can not be safely processed as standalone: the URI should be retrieved, otherwise there may be unknown named character entities whose definition may be needed to correctly parse the effective XML syntax in the internal subset or in the document body (the XML syntax parsing is normally performed <i>after</i> the substitution of all named entities, excluding the five entities that are predefined in XML and that are implicitly substituted <i>after</i> parsing the XML document into lexical tokens). If it just includes any PUBLIC identifier, it <i>may</i> be processed as standalone, if the XML processor knows this PUBLIC identifier in its local catalog from where it can retrieve an associated DTD entity. </p> <div class="mw-heading mw-heading2"><h2 id="XML_DTD_schema_example">XML DTD schema example</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=9" title="Edit section: XML DTD schema example"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An example of a very simple external XML DTD to describe the schema of a list of persons might consist of: </p> <div class="mw-highlight mw-highlight-lang-dtd mw-content-ltr" dir="ltr"><pre><span></span><span class="k"><!ELEMENT</span> <span class="nt">people_list</span> <span class="o">(</span><span class="nt">person</span><span class="o">)*</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">person</span> <span class="o">(</span><span class="nt">name</span><span class="o">,</span> <span class="nt">birthdate</span><span class="o">?,</span> <span class="nt">gender</span><span class="o">?,</span> <span class="nt">socialsecuritynumber</span><span class="o">?)</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">name</span> <span class="o">(</span><span class="kc">#PCDATA</span><span class="o">)</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">birthdate</span> <span class="o">(</span><span class="kc">#PCDATA</span><span class="o">)</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">gender</span> <span class="o">(</span><span class="kc">#PCDATA</span><span class="o">)</span><span class="k">></span> <span class="k"><!ELEMENT</span> <span class="nt">socialsecuritynumber</span> <span class="o">(</span><span class="kc">#PCDATA</span><span class="o">)</span><span class="k">></span> </pre></div> <p>Taking this line by line: </p> <ol><li><code>people_list</code> is a valid element name, and an instance of such an element contains any number of <code>person</code> elements. The <code>*</code> denotes there can be 0 or more <code>person</code> elements within the <code>people_list</code> element.</li> <li><code>person</code> is a valid element name, and an instance of such an element contains one element named <code>name</code>, followed by one named <code>birthdate</code> (optional), then <code>gender</code> (also optional) and <code>socialsecuritynumber</code> (also optional). The <code>?</code> indicates that an element is optional. The reference to the <code>name</code> element name has no <code>?</code>, so a <code>person</code> element <i>must</i> contain a <code>name</code> element.</li> <li><code>name</code> is a valid element name, and an instance of such an element contains "parsed character data" (#PCDATA).</li> <li><code>birthdate</code> is a valid element name, and an instance of such an element contains parsed character data.</li> <li><code>gender</code> is a valid element name, and an instance of such an element contains parsed character data.</li> <li><code>socialsecuritynumber</code> is a valid element name, and an instance of such an element contains parsed character data.</li></ol> <p>An example of an XML file that uses and conforms to this DTD follows. The DTD is referenced here as an external subset, via the SYSTEM specifier and a URI. It assumes that we can identify the DTD with the relative URI reference "example.dtd"; the "people_list" after "!DOCTYPE" tells us that the root tags, or the first element defined in the DTD, is called "people_list": </p> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?xml version="1.0" encoding="UTF-8" standalone="no"?></span> <span class="cp"><!DOCTYPE people_list SYSTEM "example.dtd"></span> <span class="nt"><people_list></span> <span class="w"> </span><span class="nt"><person></span> <span class="w"> </span><span class="nt"><name></span>Fred<span class="w"> </span>Bloggs<span class="nt"></name></span> <span class="w"> </span><span class="nt"><birthdate></span>2008-11-27<span class="nt"></birthdate></span> <span class="w"> </span><span class="nt"><gender></span>Male<span class="nt"></gender></span> <span class="w"> </span><span class="nt"></person></span> <span class="nt"></people_list></span> </pre></div> <p>One can render this in an XML-enabled <a href="/wiki/Web_browser" title="Web browser">browser</a> (such as <a href="/wiki/Internet_Explorer" title="Internet Explorer">Internet Explorer</a> or <a href="/wiki/Mozilla_Firefox" class="mw-redirect" title="Mozilla Firefox">Mozilla Firefox</a>) by pasting and saving the DTD component above to a text file named <i>example.dtd</i> and the XML file to a differently-named text file, and opening the XML file with the browser. The files should both be saved in the same directory. However, many browsers do not check that an XML document confirms to the rules in the DTD; they are only required to check that the DTD is syntactically correct. For security reasons, they may also choose not to read the external DTD. </p><p>The same DTD can also be embedded directly in the XML document itself as an internal subset, by encasing it within [square brackets] in the document type declaration, in which case the document no longer depends on external entities and can be processed in standalone mode: </p> <div class="mw-highlight mw-highlight-lang-xml mw-content-ltr" dir="ltr"><pre><span></span><span class="cp"><?xml version="1.0" encoding="UTF-8" standalone="yes"?></span> <span class="cp"><!DOCTYPE people_list [</span> <span class="cp"> <!ELEMENT people_list (person*)></span> <span class="w"> </span><span class="cp"><!ELEMENT person (name, birthdate?, gender?, socialsecuritynumber?)></span> <span class="w"> </span><span class="cp"><!ELEMENT name (#PCDATA)></span> <span class="w"> </span><span class="cp"><!ELEMENT birthdate (#PCDATA)></span> <span class="w"> </span><span class="cp"><!ELEMENT gender (#PCDATA)></span> <span class="w"> </span><span class="cp"><!ELEMENT socialsecuritynumber (#PCDATA)></span> ]> <span class="nt"><people_list></span> <span class="w"> </span><span class="nt"><person></span> <span class="w"> </span><span class="nt"><name></span>Fred<span class="w"> </span>Bloggs<span class="nt"></name></span> <span class="w"> </span><span class="nt"><birthdate></span>2008-11-27<span class="nt"></birthdate></span> <span class="w"> </span><span class="nt"><gender></span>Male<span class="nt"></gender></span> <span class="w"> </span><span class="nt"></person></span> <span class="nt"></people_list></span> </pre></div> <div class="mw-heading mw-heading2"><h2 id="Alternatives">Alternatives</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=10" title="Edit section: Alternatives"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Alternatives to DTDs (for specifying schemas) are available: </p> <ul><li><a href="/wiki/XML_Schema_(W3C)" title="XML Schema (W3C)">XML Schema</a>, also referred to as XML Schema Definition (XSD), has achieved Recommendation status within the W3C,<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup> and is popular for "data oriented" (that is, transactional non-publishing) XML use because of its stronger typing and easier round-tripping to Java declarations.<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (February 2011)">citation needed</span></a></i>]</sup> Most of the publishing world has found that the added complexity of XSD would not bring them any particular benefits,<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (November 2008)">citation needed</span></a></i>]</sup> so DTDs are still far more popular there. An XML Schema Definition is itself an XML document while a DTD is not.</li> <li><a href="/wiki/RELAX_NG" title="RELAX NG">RELAX NG</a>, which is also a part of <a href="/wiki/DSDL" class="mw-redirect" title="DSDL">DSDL</a>, is an ISO international standard.<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> It is more expressive than XSD,<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (February 2011)">citation needed</span></a></i>]</sup> while providing a simpler syntax,<sup class="noprint Inline-Template Template-Fact" style="white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Citation_needed" title="Wikipedia:Citation needed"><span title="This claim needs references to reliable sources. (February 2011)">citation needed</span></a></i>]</sup> but commercial software support has been slow in coming.</li></ul> <div class="mw-heading mw-heading2"><h2 id="Security">Security</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=11" title="Edit section: Security"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>An XML DTD can be used to create a denial of service (DoS) attack by defining nested entities that expand exponentially, or by sending the XML parser to an external resource that never returns.<sup id="cite_ref-XMLDenial_10-0" class="reference"><a href="#cite_note-XMLDenial-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> </p><p>For this reason, .NET Framework provides a property that allows prohibiting or skipping DTD parsing,<sup id="cite_ref-XMLDenial_10-1" class="reference"><a href="#cite_note-XMLDenial-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> and recent versions of Microsoft Office applications (Microsoft Office 2010 and higher) refuse to open XML files that contain DTD declarations. </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=12" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Journal_Article_Tag_Suite" title="Journal Article Tag Suite">JATS (Journal Article Tag Suite)</a></li> <li><a href="/wiki/Semantic_Web" title="Semantic Web">Semantic Web</a></li> <li><a href="/wiki/XML_Schema_(W3C)" title="XML Schema (W3C)">XML Schema (W3C)</a></li> <li><a href="/wiki/XML_Schema_Language_Comparison" class="mw-redirect" title="XML Schema Language Comparison">XML Schema Language Comparison</a> – Comparison to other XML Schema languages.</li></ul> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=13" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist"> <div class="mw-references-wrap"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.w3schools.com/xml/xml_dtd_intro.asp">"Introduction to DTD"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Introduction+to+DTD&rft_id=https%3A%2F%2Fwww.w3schools.com%2Fxml%2Fxml_dtd_intro.asp&rfr_id=info%3Asid%2Fen.wikipedia.org%3ADocument+type+definition" class="Z3988"></span></span> </li> <li id="cite_note-W3C,_doctypedecl-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-W3C,_doctypedecl_2-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.w3.org/TR/2004/REC-xml11-20040204/#NT-doctypedecl">"doctypedecl"</a>. <i>Extensible Markup Language (XML) 1.1</i>. W3C.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Extensible+Markup+Language+%28XML%29+1.1&rft.atitle=doctypedecl&rft_id=http%3A%2F%2Fwww.w3.org%2FTR%2F2004%2FREC-xml11-20040204%2F%23NT-doctypedecl&rfr_id=info%3Asid%2Fen.wikipedia.org%3ADocument+type+definition" class="Z3988"></span></span> </li> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFWatt2002" class="citation book cs1">Watt, Andrew H. (2002). <a rel="nofollow" class="external text" href="https://books.google.com/books?id=_NqW2BjQtFIC&pg=PP1"><i>Sams teach yourself XML in 10 minutes</i></a>. Sams Publishing. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/9780672324710" title="Special:BookSources/9780672324710"><bdi>9780672324710</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Sams+teach+yourself+XML+in+10+minutes&rft.pub=Sams+Publishing&rft.date=2002&rft.isbn=9780672324710&rft.aulast=Watt&rft.aufirst=Andrew+H.&rft_id=https%3A%2F%2Fbooks.google.com%2Fbooks%3Fid%3D_NqW2BjQtFIC%26pg%3DPP1&rfr_id=info%3Asid%2Fen.wikipedia.org%3ADocument+type+definition" class="Z3988"></span></span> </li> <li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.w3.org/TR/xml11/#dt-attdecl"><i>Attribute-list Declaration</i></a>, Specifications of <i>Extensible Markup Language</i> (XML) 1.1, W3C.</span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.w3schools.com/xml/xml_dtd_entities.asp">"DTD Entities"</a>. <i>DTD Tutorial</i>. W3Schools.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=DTD+Tutorial&rft.atitle=DTD+Entities&rft_id=https%3A%2F%2Fwww.w3schools.com%2Fxml%2Fxml_dtd_entities.asp&rfr_id=info%3Asid%2Fen.wikipedia.org%3ADocument+type+definition" class="Z3988"></span></span> </li> <li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.w3.org/TR/REC-xml/#Notations"><i>Notation Declarations</i></a>, Specifications of <i>Extensible Markup Language</i> (XML) 1.0, W3C.</span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="http://www.w3.org/TR/xml11/#NT-PublicID"><i>Notation Declarations</i></a>, Specifications of <i>Extensible Markup Language</i> (XML) 1.1, W3C.</span> </li> <li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/">"XML Schema Part 1: Structures (Second Edition)"</a>. W3C. 2004<span class="reference-accessdate">. Retrieved <span class="nowrap">2022-01-02</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=XML+Schema+Part+1%3A+Structures+%28Second+Edition%29&rft.pub=W3C&rft.date=2004&rft_id=https%3A%2F%2Fwww.w3.org%2FTR%2F2012%2FREC-xmlschema11-1-20120405%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3ADocument+type+definition" class="Z3988"></span></span> </li> <li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.iso.org/iso/home/store/catalogue_ics/catalogue_detail_ics.htm?csnumber=52348">"ISO/IEC 19757-2:2008 - Information technology -- Document Schema Definition Language (DSDL) -- Part 2: Regular-grammar-based validation -- RELAX NG"</a>. ISO<span class="reference-accessdate">. Retrieved <span class="nowrap">2011-05-17</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=ISO%2FIEC+19757-2%3A2008+-+Information+technology+--+Document+Schema+Definition+Language+%28DSDL%29+--+Part+2%3A+Regular-grammar-based+validation+--+RELAX+NG&rft.pub=ISO&rft_id=http%3A%2F%2Fwww.iso.org%2Fiso%2Fhome%2Fstore%2Fcatalogue_ics%2Fcatalogue_detail_ics.htm%3Fcsnumber%3D52348&rfr_id=info%3Asid%2Fen.wikipedia.org%3ADocument+type+definition" class="Z3988"></span></span> </li> <li id="cite_note-XMLDenial-10"><span class="mw-cite-backlink">^ <a href="#cite_ref-XMLDenial_10-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-XMLDenial_10-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBryan_Sullivan2009" class="citation web cs1">Bryan Sullivan (November 2009). <a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/magazine/ee335713.aspx">"XML Denial of Service Attacks and Defenses"</a>. MSDN Magazine<span class="reference-accessdate">. Retrieved <span class="nowrap">2013-10-21</span></span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=XML+Denial+of+Service+Attacks+and+Defenses&rft.pub=MSDN+Magazine&rft.date=2009-11&rft.au=Bryan+Sullivan&rft_id=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Fmagazine%2Fee335713.aspx&rfr_id=info%3Asid%2Fen.wikipedia.org%3ADocument+type+definition" class="Z3988"></span></span> </li> </ol></div></div> <div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Document_type_definition&action=edit&section=14" title="Edit section: External links"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a rel="nofollow" class="external text" href="http://www.w3.org/TR/REC-xml/#dt-doctype">Definition of the XML document type declaration from Extensible Markup Language (XML) 1.0 (Fourth Edition) on W3.org</a></li></ul> <!-- NewPP limit report Parsed by mw‐web.eqiad.main‐5dc468848‐rtbhh Cached time: 20241122140404 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.370 seconds Real time usage: 2.445 seconds Preprocessor visited node count: 1713/1000000 Post‐expand include size: 21092/2097152 bytes Template argument size: 3829/2097152 bytes Highest expansion depth: 15/100 Expensive parser function count: 42/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 47911/5000000 bytes Lua time usage: 0.159/10.000 seconds Lua memory usage: 4681033/52428800 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 2353.130 1 -total 5.95% 140.105 1 Template:Reflist 4.70% 110.713 6 Template:Cite_web 4.09% 96.273 1 Template:Short_description 3.01% 70.816 4 Template:Citation_needed 2.54% 59.697 4 Template:Fix 2.53% 59.455 2 Template:Pagetype 1.40% 32.887 8 Template:Category_handler 1.14% 26.757 1 Template:As_of 1.05% 24.770 8 Template:Main_other --> <!-- Saved in parser cache with key enwiki:pcache:idhash:8537-0!canonical and timestamp 20241122140404 and revision id 1212673118. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=Document_type_definition&oldid=1212673118">https://en.wikipedia.org/w/index.php?title=Document_type_definition&oldid=1212673118</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:SGML" title="Category:SGML">SGML</a></li><li><a href="/wiki/Category:XML" title="Category:XML">XML</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_matches_Wikidata" title="Category:Short description matches Wikidata">Short description matches Wikidata</a></li><li><a href="/wiki/Category:Articles_containing_potentially_dated_statements_from_2009" title="Category:Articles containing potentially dated statements from 2009">Articles containing potentially dated statements from 2009</a></li><li><a href="/wiki/Category:All_articles_containing_potentially_dated_statements" title="Category:All articles containing potentially dated statements">All articles containing potentially dated statements</a></li><li><a href="/wiki/Category:All_articles_with_unsourced_statements" title="Category:All articles with unsourced statements">All articles with unsourced statements</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_February_2011" title="Category:Articles with unsourced statements from February 2011">Articles with unsourced statements from February 2011</a></li><li><a href="/wiki/Category:Articles_with_unsourced_statements_from_November_2008" title="Category:Articles with unsourced statements from November 2008">Articles with unsourced statements from November 2008</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 9 March 2024, at 01:17<span class="anonymous-show"> (UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=Document_type_definition&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.canary-84779d6bf6-crlgt","wgBackendResponseTime":197,"wgPageParseReport":{"limitreport":{"cputime":"0.370","walltime":"2.445","ppvisitednodes":{"value":1713,"limit":1000000},"postexpandincludesize":{"value":21092,"limit":2097152},"templateargumentsize":{"value":3829,"limit":2097152},"expansiondepth":{"value":15,"limit":100},"expensivefunctioncount":{"value":42,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":47911,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 2353.130 1 -total"," 5.95% 140.105 1 Template:Reflist"," 4.70% 110.713 6 Template:Cite_web"," 4.09% 96.273 1 Template:Short_description"," 3.01% 70.816 4 Template:Citation_needed"," 2.54% 59.697 4 Template:Fix"," 2.53% 59.455 2 Template:Pagetype"," 1.40% 32.887 8 Template:Category_handler"," 1.14% 26.757 1 Template:As_of"," 1.05% 24.770 8 Template:Main_other"]},"scribunto":{"limitreport-timeusage":{"value":"0.159","limit":"10.000"},"limitreport-memusage":{"value":4681033,"limit":52428800}},"cachereport":{"origin":"mw-web.eqiad.main-5dc468848-rtbhh","timestamp":"20241122140404","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Document type definition","url":"https:\/\/en.wikipedia.org\/wiki\/Document_type_definition","sameAs":"http:\/\/www.wikidata.org\/entity\/Q212327","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q212327","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2001-09-27T18:28:32Z","dateModified":"2024-03-09T01:17:29Z","headline":"set of markup declarations that define a document type for an SGML-family markup language"}</script> </body> </html>