[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Should I use defaults in my DTD?

  • From: "Joshua E. Smith" <jesmith@k...>
  • To: "XML Developers' List" <xml-dev@i...>
  • Date: Tue, 04 May 1999 21:49:03 -0400

which dtd should i use
Two more questions were raised as I memorized the XML spec (heh, heh).

1) Should I specify defaults in my DTD?

My application knows what all the default values should be, so,
technically, all the attributes on my elements could be #IMPLIED.  However,
it would seem likely to me that a good editor might tell the user what
attributes exist for a given element they've inserted, and show them the
default values from the DTD.  The user could then easily decide what
attributes need non-default values without looking in the object model
documentation.

However, I'm a little paranoid that some not-so-smart editors might read
the DTD, get all the defaults, treat them as though they were specified by
the user, and dump tons of default attributes into the saved file causing
massive bloat.  Would an editor really do that?  (In their book, Ian & Liam
seemed to imply that they thought one might.)

2) Should I use entities for URL attributes?

Since the XML spec has gone to all that trouble to support external
unparsed entities, it seems a little callous for me to call my attributes
which are URLs ordinary CDATA.  However, I have a really hard time seeing
any value in making the user of my DTD go to the trouble of declaring the
various JPGs and such as entities, when I know I'm just going to use the
URL string anyway.

Am I missing something?  Is there a reason why:

[Up in the DTD...]
<!ENTITY TheImage SYSTEM "TheImage.jpg" NDATA JPG>

[Down in the document...]
<texture image="TheImage" />

is preferable to:

[Alone in the document...]
<texture image="TheImage.jpg" />

The latter is so much simpler...

-Joshua Smith


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.