AllExperts > Experts 
Search      

XML

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More XML Answers
Question Library

Ask a question about XML
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ashvin
Expertise
I can handle all the queries related to XML. I can sort out problems regarding XSLT and XSL. I work using MSXML components. I can handle XML-SQl, XML-VB and XMl-ASP related queries.

Experience
I have worked for 2years in this feild. I have worked in SGML and DTDs, and now working in XML and Schemas.

 
   

You are here:  Experts > Computing/Technology > HTML/XML > XML > DTD

Topic: XML



Expert: Ashvin
Date: 4/19/2005
Subject: DTD

Question
Hello Sir,
Thanks for response.Now I am more clear about XML but w/o implementation it is not so much.I make a test program


<?xml version="1.0"?>
<!DOCTYPE note [
 <!ELEMENT note    (to,from,heading,body)>
 <!ELEMENT to      (#PCDATA)>
 <!ELEMENT from    (#PCDATA)>
 <!ELEMENT heading (#PCDATA)>
 <!ELEMENT body    (#PCDATA)>      
]>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

But when i remove the  <!ELEMENT body    (#PCDATA)> from its dtd implementation then there is no effect on xml file .It remains same.Acc to me the body tag should be remove from xml file at run time on browser.
Pls explain this also
Thanks again
Regards Ankit



Followup To
Question -
Sir,
I want to know what is the actual use of dtd.What is the benefit of using dtd .i read the defination of dtd ie

"The purpose of a Document Type Definition is to define the legal building blocks of an XML document. It defines the document structure with a list of legal elements."

Pls explain in ur own words clearly.Where we have to use this DTD.
Thanks and regs
Ankit




Answer -
Hello Ankit,

DTD is the "Document type deaclaration". It itself explains what is means.

When you work in XML you use dtd's. It is optional for the XML.

we use DTD's in case of big publication companies, where XML files are created by many users and we need to follow same rules.

Here is the example of one.

You want to make an XML file, but you want to use some specified tags only. There you define one DTD which contains all the tags and validation which you allow to use in the XML file.

Suppose you want to amke XMl file data for the employees and u want to use specified tags in the XMl file so that whenever or whoever create this XML file with this DTD which you have created, uses only those tags which you want them to use.

DTD is a kind of restriction which you give to the client so that he cannot use any other tag except which you have defined in the DTD.

For case of employees you have created a DTD which incude tags.

EMP
EMPID
EMPNAME
EMPSALARY
Now you are retricted to use these tags only for the XML file, by including DTD in your XML file.  

Answer
Hello Ankit,

This will sure give you error. There may your browser which is not supporting. may be your browser is not supporting parser to the XML file. Try to download XMLSYP and then parse the file or you can write your own code to parse XML file, in which ever language you know to write code. Please see that your Programming language should support COM.  

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.