Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

A generic XML DTD

843834Jul 25 2001 — edited Jul 25 2001
I am a newbie to XML and I have a question on XML/Java, hopefully, you guys would be able to give me some pointers to solve this problem.
Here is the scenario. I need to design (might have to implement as well) a set of Java libraries that can retrieve data (basically, it's some kind of contents, it can be anything, more on this later) and base on the data I retrieved, I would generate a html file (which contains those contents and have the contents displayed).
Those data (contents) I talked about earlier could be some news item, could be lottery results, could be a travel guide, could be anything. Those data would originally come from a XML file and then store into a database table. (or could just be in a file if there isn't much data). Either way, my programs should be able to read the data from the database/files and somehow "decrypt" it.
Now, my problem is since the data could contain any kind of data, how do I define a DTD that is so generic that can treat all kinds of contents as the same. By that, I mean, e.g if it was a book review article, it might contain the book's name, the author, the review, the review date...etc, I would imagine that the DTD would contain tags like TITLE, AUTHOR, REVIEW DATE, REVIEW...etc. With all these data, they would be stored into a table, may be just a text field in that table. And then my programs would read from that field and break up those tags and display them accordingly (generate a html file) . But what if it is a lottery result, then the DTD that I defined earlier (for news) would not be applicable for the lottery result content. That means, in order to treat everything as just pure content, I can only have a tag, say content, and for the book review article, this tag would just wrap everything into itself (from the book's name, author....etc) and for the lottery results, the content tag would just contain the numbers. I must say, I have minimal XML knowledge, so please correct me if I am wrong here. But again, how would you define a DTD for such scenario? Is it possible to define such a DTD? Not to mention the style of the contents.......Please, I need help. THx
anywhere else is a better place for XML forums?

Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 22 2001
Added on Jul 25 2001
1 comment