Magazine
 

XML : DTD

 

<?xml version=”1.0" encoding=”ISO-8859-
1"?>
<E-mail >
<date>
<day>12</day>
<month>11</month>
<year>99</year>
</date>
<To>Rohan</To>
<From>Amit</From>
<Subject>Surprise....</Subject>
<Body>Be ready for a cruise...i will catch u
tonight</Body>
</E-mail>

XML Validation

XML with correct syntax is Well Formed XML. XML validated against a DTD or a Schema is a Valid XML.

Well Formed XML Documents

A “Well Formed” XML document has correct XML syntax. A “Well Formed” XML document is a document that conforms to the XML syntax rules which were described previously.

• XML documents must have a root element
• XML elements must have a closing tag
• XML tags are case sensitive
• XML elements must be properly nested
• XML attribute values must always be quoted

<?xml version=”1.0" encoding=”ISO-8859-
1"?>
<E-mail>
<To>Rohan</To>
<From>Amit</From>
<Subject>Surprise....</Subject>
<Body>Be ready for a cruise...i will catch u
tonight</Body>
</E-mail>

Valid XML Documents:

A “Valid” XML document is a “Well Formed” XML document, which also conforms to the rules of a Document Type Definition (DTD) or a XML

 

Schema.

The following xml document is validated against a DTD , notice the highlighted text.

<?xml version=”1.0" encoding=”ISO-8859-
1"?>
<!DOCTYPE e-mail SYSTEM “InternalEmail.
dtd”>
<E-mail>
<To>Rohan</To>
<From>Amit</From>
<Subject>Surprise....</Subject>
<Body>Be ready for a cruise...i will catch u
tonight</Body>
</E-mail>

XML DTD

A DTD defines the legal elements of an XML document. The purpose of a DTD is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements.

XML Schema

XML Schema is an XML based alternative to DTD .W3C supports an alternative to DTD called XML Schema.

Designing XML DTD


1. Introduction to DTD
2. DTD - XML Constituent Components
3. DTD Elements
4. DTD Attributes
5. DTD Entities
1. Introduction to DTD:

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 defined inside a XML document,
or a external reference can be declared.

Internal DTD

If the DTD is defined inside the XML

     
Jan  2008 | Java Jazz Up |29
 
previous
index
next
 
View All Topics
All Pages of this Issue
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 ,

83, 84 , 85 , 86, 87 , 88, 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 , 101 , 102 , 103, 104 , 105 ,

106, 107,

Download PDF