Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dtd design (element or attribute)

Status
Not open for further replies.

ozane

Technical User
Feb 3, 2005
57
TR
hi, i am designing a DTD file. but i have hesitations.
i placed child elements as attributes. but as far as the examples are concerned about my purpose, designers didnt use attributes, they used child element. what is the difference?? which way should i prefer?
example (elemet):
<! element a (b*, c*)>
<!elemen a (#PCDATA)>
<!element b (#PCDATA)>

(attribute)
<! element a (b*, c*)>
<!element a(#PCDATA)>
<!attribute a b CDATA #IMPLIED c CDATA #IMPLIED>
 
Either way, its up to you and doesnt really matter. Personally I try to stick to using elements as they are extensible and also to make the processing more consistent, but in most cases there is nothing wrong with using attributes.
 
Nodes are conceptual entities or objects in their own right; eg. books, people, etc

Attributes are there to assign properties to a node; eg. people have names or userids, books that have ISDN and ID numbers.

Conceptually, if you can break down your problem as if you're breaking down objects in a programming language then you're on the right tracks, but Jonty is essentially right - there is no right way really.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top