473,378 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Need opinion on DTD design

Hi,

I am a newbie to programming using XML and I'm currently working on a
side-project which will house some database information in a XML-file.
I am writing a DTD to specify the XML-format, mostly for the purpose of
documenting the XML database.

My issue is that I have some fields, e.g.
<!ELEMENT Vehicle ( Car? )>
<!ELEMENT Car ( Gasoline | Diesel )>
<!ELEMENT Gasoline EMPTY>
<!ELEMENT Diesel EMPTY>

but I want to make sure that this database is extendable. I.e. after
using the database for a while in my application I want to be able to
add stuff that I come up with later on, e.g.
<!ELEMENT Motorcycle ( Sportbike | Harley )>
<!ELEMENT Sportbike EMPTY>
<!ELEMENT Harley EMPTY>

I'd rather not add a lot of "Reserved"-elements in the DTD, as this is
not a nice solution. My own little idea is that i'm anyway able to add
items to the DTD further on since I both have the DTD of the XML and
the source of the application using it. Is this correct?

I've looked around and found another way to do this and that is to
include the old DTD as an entity, is that the way to go?

Please excuse my newbie-question, I just want to know if my way of
thinking is correct.

Thanks a lot for reading!

Aug 3 '06 #1
3 1172
Hi Stefan,

I would recommend looking into using a schema language (XML Schema,
Relax NG) instead of a DTD.
With DTD probably the best approach is to use parameter entities to
define the content model for elements and the available attributes. You
can look at DocBook 4 for an example of using parameter entities. Note
that the next version of DocBook, DocBook 5 will provide a Relax NG
schema. More, it should be possible to convert from schema to DTD so if
you need to provide also a DTD then you will be able to do so. DocBook
5 for instance will provide also a DTD and an XML Schema.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
st**************@gmail.com wrote:
Hi,

I am a newbie to programming using XML and I'm currently working on a
side-project which will house some database information in a XML-file.
I am writing a DTD to specify the XML-format, mostly for the purpose of
documenting the XML database.

My issue is that I have some fields, e.g.
<!ELEMENT Vehicle ( Car? )>
<!ELEMENT Car ( Gasoline | Diesel )>
<!ELEMENT Gasoline EMPTY>
<!ELEMENT Diesel EMPTY>

but I want to make sure that this database is extendable. I.e. after
using the database for a while in my application I want to be able to
add stuff that I come up with later on, e.g.
<!ELEMENT Motorcycle ( Sportbike | Harley )>
<!ELEMENT Sportbike EMPTY>
<!ELEMENT Harley EMPTY>

I'd rather not add a lot of "Reserved"-elements in the DTD, as this is
not a nice solution. My own little idea is that i'm anyway able to add
items to the DTD further on since I both have the DTD of the XML and
the source of the application using it. Is this correct?

I've looked around and found another way to do this and that is to
include the old DTD as an entity, is that the way to go?

Please excuse my newbie-question, I just want to know if my way of
thinking is correct.

Thanks a lot for reading!
Aug 3 '06 #2
Hi George!

Thanks a lot for the reply, it is greatly appreciated and I will look
into this immediately!

With best regards, Stefan

George Bina wrote:
Hi Stefan,

I would recommend looking into using a schema language (XML Schema,
Relax NG) instead of a DTD.
With DTD probably the best approach is to use parameter entities to
define the content model for elements and the available attributes. You
can look at DocBook 4 for an example of using parameter entities. Note
that the next version of DocBook, DocBook 5 will provide a Relax NG
schema. More, it should be possible to convert from schema to DTD so if
you need to provide also a DTD then you will be able to do so. DocBook
5 for instance will provide also a DTD and an XML Schema.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
st**************@gmail.com wrote:
Hi,

I am a newbie to programming using XML and I'm currently working on a
side-project which will house some database information in a XML-file.
I am writing a DTD to specify the XML-format, mostly for the purpose of
documenting the XML database.

My issue is that I have some fields, e.g.
<!ELEMENT Vehicle ( Car? )>
<!ELEMENT Car ( Gasoline | Diesel )>
<!ELEMENT Gasoline EMPTY>
<!ELEMENT Diesel EMPTY>

but I want to make sure that this database is extendable. I.e. after
using the database for a while in my application I want to be able to
add stuff that I come up with later on, e.g.
<!ELEMENT Motorcycle ( Sportbike | Harley )>
<!ELEMENT Sportbike EMPTY>
<!ELEMENT Harley EMPTY>

I'd rather not add a lot of "Reserved"-elements in the DTD, as this is
not a nice solution. My own little idea is that i'm anyway able to add
items to the DTD further on since I both have the DTD of the XML and
the source of the application using it. Is this correct?

I've looked around and found another way to do this and that is to
include the old DTD as an entity, is that the way to go?

Please excuse my newbie-question, I just want to know if my way of
thinking is correct.

Thanks a lot for reading!
Aug 3 '06 #3
st**************@gmail.com wrote:
Hi,

I am a newbie to programming using XML and I'm currently working on a
side-project which will house some database information in a XML-file.
I am writing a DTD to specify the XML-format, mostly for the purpose of
documenting the XML database.

My issue is that I have some fields, e.g.
<!ELEMENT Vehicle ( Car? )>
<!ELEMENT Car ( Gasoline | Diesel )>
<!ELEMENT Gasoline EMPTY>
<!ELEMENT Diesel EMPTY>

but I want to make sure that this database is extendable. I.e. after
using the database for a while in my application I want to be able to
add stuff that I come up with later on, e.g.
<!ELEMENT Motorcycle ( Sportbike | Harley )>
<!ELEMENT Sportbike EMPTY>
<!ELEMENT Harley EMPTY>
<!ENTITY % bikes SYSTEM "list.of.bikes">
....
<!ELEMENT Motorcycle EMPTY>
<!ATTLIST Motorcycle type (%bikes;) #REQUIRED>

where the file list.of.bikes contains something like

Sportbike|
Harley|
Triumph|
Yamaha

etc.

Now to keep the list up to date, you just have to edit list.of.bikes

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Aug 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
by: Steven T. Hatton | last post by:
I came across this while looking for information on C++ and CORBA: http://www.zeroc.com/ice.html. It got me to wondering why I need two different languages in order to write distributed computing...
4
by: nsr93 | last post by:
I am not sure if this was the proper group to post this, but here is my question: I am a Java consultant. I have new client I am working for to make a web based application similar to an...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
17
by: Chad A. Beckner | last post by:
Hey all, I've spent all day trying to figure this out. What I need is a script to grab a webpage and display it as an (thumbnail?) image on one of my pages. GotDotNet has a webservice to do...
2
by: artificer | last post by:
I want to develop a web application that will manage the online registration and class schedule selection process for a small university in the Caribbean. The application should support around 50...
18
by: bsruth | last post by:
I tried for an hour to find some reference to concrete information on why this particular inheritance implementation is a bad idea, but couldn't. So I'm sorry if this has been answered before....
20
by: C# Beginner | last post by:
I'm currently creating a database class, which contains a member called Open(). With this method users can open different databases. When a user tries to open a database which happens to be secured...
25
by: Daniel Jonsson | last post by:
So, I've reached the point where my building pipeline tools actually needs to be used by other people in my company. By this reason I actually need to think about the usability, and I've come to...
2
by: cephal0n | last post by:
Hi All! First of I apologize for my previews post needing help on union select and not providing so more explanation, but thank you very much for your opinion and sugestion. I have thought about my...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.