Re: attribute vs value

Subject: Re: attribute vs value
From: "John Markor" <john.markor@xxxxxxxxxxxx>
Date: Sun, 23 May 1999 22:16:43 -0700
ÿþ<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=unicode" http-equiv=Content-Type> <META content="MSHTML 5.00.2314.1000" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#d8d0c8> <DIV><FONT face=Arial size=2>Yes - one good rule of thumb that I've used is that information used by the processing engine should be an attribute - information that is to be considered content should be an element.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>For example - I may have a particular DTD which calls in several other files as notational entities during run time.&nbsp;Since the processing system has no way of knowing what the documents consist of - I need to develop a static TOC.&nbsp; This document may have the section titles as attributes of the element Section, i.e.; </FONT></DIV> <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV> <DIV><FONT face=Arial size=2>&lt;!ELEMENT section .....</FONT></DIV> <DIV><FONT face=Arial size=2>&lt;!ATTLIST section ....</FONT></DIV> <DIV><FONT face=Arial size=2>&nbsp;&nbsp; title&nbsp; CDATA&nbsp; #IMPLIED </FONT></DIV> <DIV><FONT face=Arial size=2>.....</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>In this manner, I can develop a static TOC for a document without the processing system having prior knowledge of what the notational entities consist of.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=Arial size=2>While this isn't a perfect solution - and will never work in all instances, it does illustrate one way in which an attribute is preferable to an element, in this case "title"</FONT></DIV> <DIV>&nbsp;</DIV> <DIV>&nbsp;</DIV></BODY></HTML>
Current Thread