[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Add elements in XML file not declared in the DTD

Posted on 2008-10-09
1
Medium Priority
?
382 Views
Last Modified: 2008-10-15
I have created a DTD with the basic structure of my XML File. But my XML file can contain elements which are not declared in the DTD. How can i acheive this using DTD? Is there any tag in DTD with the help of which this can be acheived?


Suppose my DTD is 
 
<!ELEMENT subject (books, teachers) >
<!ELEMENT books (#PCDATA) >
<!ELEMENT teachers (#PCDATA) >
 
and my XML File is
 
<subject>
   <books>
      <book1 />
      <book2 />
   </books>
   <teachers />
</subject>
 
How can I acheieve this kind of functionality such that my DTD validates my XML file and gives no parsing error.

Open in new window

0
Comment
Question by:jdsiam
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 1500 total points
ID: 22684618
You can't.
You could use XML Schema.
There you can tell that the content of an element can be anything and that the validation should be "lax" for that part.
With DTD you can't achieve that.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Screencast - Getting to Know the Pipeline

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question