• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

dtd tags

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi guys
please explain dtd tags in xml and why it neccessary
iam new to xml
regards
bala
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I recently did a course in this..
A DTD (document type definition) specifies the structure of elements for an XML document. By specifying a particular DTD a user of the XML document can ensure that the XML document meets the specification. Here is an example of an XML document...(pardon me not tabbing in the tags)
<?xml version="1.0"?>
<!DOCTYPE products SYSTEM "MyDTD.dtd">
<company>
<contact>
<id>1</id>
<FirstName>Jim</FirstName>
</contact>
</company>
Now here is the MyDTD.dtd file.
<!ELEMENT company (contact)*>
<!ELEMENT contact (id, firstname)>
<!ELEMENT id (#PCDATA)>
<!ELEMENT firstname (#PCDATA)>
The DTD above tells that an element of type "company" must exist and it contains a "contact". The * indicates that zero or more contacts can exist for a company. The second line indicates that each contact element has an id and a firstname element. Without the *, this says that there can be only one id and firstname for each contact element. Finally, the #PCDATA keyword indicates the parsed data itself.
The benefit of a DTD is that it can be shared by multiple businesses that share similar data. This, however, is done mostly nowadays with something called Schemas which is something else entirely.
Hope this helps!
[This message has been edited by kking (edited September 19, 2000).]
[This message has been edited by kking (edited September 19, 2000).]
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem with the DTD (document type definition)
is that it's syntax is different from normal xml,
so parser have to use extra methods to parse the dtd.
That's why schemas are introduced. A schema has the
same function as a DTD but has XML-Syntax.
At the moment DTD is still the standard because
Schemas haven't got the recommended status from
the W3 consortium yet.
Bye, Ingo
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic