Introduction to DTD

--------------------
--------------------
--------------------
--------------------
X
W3Schools.com
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

*DTD Tutorial*

DTD HOME DTD Introduction DTD Building Blocks DTD Elements DTD Attributes
DTD Elements vs Attr DTD Entities DTD Validation DTD Examples DTD Summary


** Introduction to DTD **

« Previous
Next Chapter »
--------------------

A Document Type Definition (DTD) defines the legal building blocks of an
XML document. It defines the document structure with a list of legal
elements and attributes.

A DTD can be declared inline inside an XML document, or as an external
reference.

--------------------

*Internal DTD Declaration*

If the DTD is declared inside the XML file, it should be wrapped in a
DOCTYPE definition with the following syntax:



Example XML document with an internal DTD:







]>

Tove
Jani
Reminder
Don't forget me this weekend


Open the XML file above in your browser (select "view source" or "view page
source" to view the DTD)

The DTD above is interpreted like this:

· *!DOCTYPE note* defines that the root element of this document is note
· *!ELEMENT note* defines that the note element contains four elements:
"to,from,heading,body"
· *!ELEMENT to* defines the to element to be of type "#PCDATA"
· *!ELEMENT from* defines the from element to be of type "#PCDATA"
· *!ELEMENT heading* defines the heading element to be of type "#PCDATA"
· *!ELEMENT body* defines the body element to be of type "#PCDATA"

--------------------

*External DTD Declaration*

If the DTD is


Source: www.w3schools.com/dtd/dtd_intro.asp


why dtd


Document type definition - Wikipedia, the free encyclopedia

--------------------

** Document type definition **

From Wikipedia, the free encyclopedia
Jump to: navigation, search

A *document type definition* (*DTD*) is a set of /markup declarations/ that
define a /document type/ for an SGML-family markup language (SGML, XML,
HTML).

A Document Type Definition (DTD) defines the legal building blocks of an
XML document. It defines the document structure with a list of legal
elements and attributes. A DTD can be declared inline inside an XML
document, or as an external reference. ^[1]

XML uses a subset of SGML DTD.

As of 2009^[update], newer XML namespace-aware schema languages (such as
W3C XML Schema and ISO RELAX NG) have largely superseded DTDs. A
namespace-aware version of DTDs is being developed as Part 9 of ISO
DSDL[1]. DTDs persist in applications that need special publishing
characters, such as the XML and HTML Character Entity References, which
derive from larger sets defined as part of the ISO SGML standard effort.

*Contents*

· 1 Associating DTDs with documents

· 1.1 Examples

· 2 Markup declarations

· 2.1 Element type declarations
· 2.2 Attribute list declarations
· 2.3 Entity declarations
· 2.4 Notation declarations

· 3 XML DTDs and schema validation
· 4 XML DTD schema example
· 5 Security
· 6 See also
· 7 References
· 8 External links

*Associating DTDs with documents[edit]*

A DTD is associated with an XML or SGML document by means of a document
type declaration (DOCTYPE). The DOCTYPE appears in the syntactic fragment
/doctypedecl/ near the start of an XML document.^[2] The declaration
establishes that the document is an instance of the type defined by the
referenced DTD.

DTDs make two sorts of declaration:

· an optional /external subset/
· an optional /internal subset/

The


Source: en.wikipedia.org/wiki/Document_type_definition

© 2005-2018 HaveYourSay.org