Thank you for the advice.  I thought about schemas after sending the query.  I'm only hesitant to use them, not because I think DTDs are better, but rather there's a learning curve to Schemas that I perceive as larger than DTDs since I already had a fundamental understanding of how DTDs work.
 
Also, my requirements are fairly straight-forward; The information I would be storing in the attributes is simply key-value pairs.  Theoretically, one may need to have a preposterous amount of key-value pairs in the single element and it would probably not look very nice, but my thinking was that in the common case there would only be a handful of attributes on that element and by putting it in the element as an attribute, on a SAX parse (or DOM for that matter), I have all the information I need in one event (namely the startElement event).  I wouldn't have to worry about storing hierarchy and wouldn't have to go searching through a tree (when in DOM) to find the datum I'm looking for.
 
I'm not sure that this problem will change at all by moving to Schemas though.  Do you have another suggestion now that you know more of the problem domain, or does your original suggestion stand?
 
Thank you.
 
Brion Swanson
-----Original Message-----
From: O'Hearne, Bradley [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 14, 2001 1:34 PM
To: '[EMAIL PROTECTED]'
Subject: RE: First-time writing DTD - simple question

Brion,
 
While I am sure the common response might be taking a look at Schemas, because they are much more rich, here is another idea.  As a general rule (general mind you), attributes are used for meta-data, and content is reserved for the data itself.  In your case, it appears you have extensive meta-data requirements, for which attributes might not be sufficient.  Rather than trying to implement this extensive meta-data as attributes, why not declare a new element "meta" as the first element in foo's content model?  Meta then serves as a very rich header for all of the following data.
 
<!ELEMENT foo (meta, <.....other elements in the content model here>)>
<!ELEMENT meta ANY>
 
This way, your meta-data is not only unlimited, but can also be hierarchical.
 
BradO
-----Original Message-----
From: Swanson, Brion [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 14, 2001 9:44 AM
To: '[EMAIL PROTECTED]'
Subject: First-time writing DTD - simple question

I have a fairly simple question regarding attribute delcarations in a DTD.
 
I know it's possible to declare an element of content type 'ANY', but can do you do the same for the attribute list?
 
What I need is an element who's name is guaranteed (let's say 'foo'), but which may have any number of attributes whose names do not matter.
 
An example would be:
 
<foo test1="value1" test2="value2" whatever="don't care"/>
 
Is this possible in a DTD?  If so, what might be the declaration given the 'foo' example?
 
Thank you for your help.

--------------
Brion Swanson
Software Engineer (Co-op)
West Group - Public Records
[EMAIL PROTECTED]
716-327-6164 (x6164)

 

Reply via email to