Solved

Add elements in XML file not declared in the DTD

Posted on 2008-10-09
1
331 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 500 total points
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

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…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now