Re: Need opinion on DTD design



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


stefan.rickfjord@xxxxxxxxx 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!

.



Relevant Pages

  • [ANN] New XML Editor in Visual Studio 2005 Beta 1
    ... Full syntax coloring for all XML and DTD syntax. ... Intellisense based on any DTD, ... Schema picker dialog for overriding schemas used for validation, which is then remembered as a document property in your solution. ... Goto Definition command for navigating between elements and their associated DTD, XDR or XSD schema definitions. ...
    (microsoft.public.dotnet.xml)
  • Re: Help with validating XML (DTD or Schema) with PERL
    ... to handle DTD or Schemas? ... Amongst the many things I've happily & successfully done with Perl & ... parsing XML is not one. ... original thought I would easily find a FILTER to handle DTD or Schema ...
    (comp.lang.perl.modules)
  • Re: my first xml schema - I think its good. Is it really?
    ... The current recommendations are either to use just enough of a DTD to provide those and to use schema for the rest, or to use some other macro facility or to define tags for the purpose. ... XML was rushed into use before it was stable. ... but we didn't have that luxury; in order for XML to win acceptance as quickly as it did, it had to be rolled out in stages, syntax first. ...
    (comp.text.xml)
  • Validating XML against a DTD that is not supplied in the XML Schema
    ... I'm talking the problem of trying to validate whether a rss xml feed ... is well formed - i.e corresponds to the DTD and xml schema ... Sometimes a schema is referenced, ...
    (comp.lang.java.programmer)
  • Re: Lets think who will like to say delphi is dying?
    ... if that particular DTD rules it out. ... there are 2 basic usage forms for XML. ... HTML is/canbe quite strict too. ... Parsing and compiling are kind of the same thing.. ...
    (borland.public.delphi.non-technical)