XML DTDAral

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

XMD DTD DOCTYPE

• XML Document Type Declaration • has exclamation mark (!)


• Wat to describe XML language At the start of the element name.
precisely. • informs the parser that DTD is associated
• Checks vocabulary & validity of the with XML document.
structure of XML docs. Against • DTD Body – where you declare elements,
grammatical rules of appropriate XML attributes, entities, and notations.
language. • <!ELEMENT name (#PCDATA)>
• Can be inside the docs., can be Defines the element name to be of type
separate “PCDATA”.
• #PCDATA – parse-able text data
Syntax
<!DOCTYPE element DTD identifier END DECLARATION
• Closed using a closing bracket and a
[declaration 1 closing angle bracket (]>).
declaration 2

]> Rules
1. The document type declaration must appear
In above syntax at the start of the document (preceded only
• DTD starts with <!DOCTYPE delimiter. by the XML header) – it is not permitted
• Element - tells the parser to parse the anywhere else within the document.
document from the specified root 2. Similar to the DOCTYPE declaration, the
element. element declarations must start with and
• DTD Identifier – identifier for the exclamation mark.
document type definition, which may be 3. The Name n the document type declaration
the path to a file on the system or URL. must match the element type of the root
• External Subset – when DTD is element.
pointing to external path.
• Internal Subset – the “[ ]” enclose an External DTD
optional list of entity declaration. • Elements are declared outside the XML
file
Internal DTD • Accessed by specifying the system
• <xsl:template> - element used to attributes which may be either the legal
build templates. .dtd file or a valid URL.
• When elements are declared within • Use standalone “no” declaration to
the XML files. refer it is an external DTD.
• Use standalone “yes” declaration to Syntax
refer it as internal DTD. DTD-
<!DOCTYPE root-element SYSTEM “file-name”>
Syntax for internal DTD where file-name is the file with .dtd extension
<!DOCTYPE root-element [element-declaration]>

DTD − Immediately after the XML header,


the document type declaration follows,
commonly referred to as the
DOCTYPE –
<!DOCTYPE address [

You might also like