[
Lists Home |
Date Index |
Thread Index
]
- From: "Rick Jelliffe" <ricko@allette.com.au>
- To: "'xml-dev@ic.ac.uk'" <xml-dev@ic.ac.uk>
- Date: Wed, 27 Aug 1997 09:47:40 +1000
> From: John Gossman <JohnGo@asymetrix.com>
> >Option 1 then is the
> >following:
> >
> ><button>
> > <caption type="string" value="Click Here"/>
> > <left type="int" value="50"/>
> > <right type="int" value="100"/>
> > <top type="int" value="80"/>
> > <bottom type="int" value="100"/>
> ></button>
> >
> > There is precedent for such a thing, in HTML's IMG tag for example, which
> >is an empty tag with all the "data" in attributes. My question then. Is
> >this better?:
> >
> ><button>
> > <caption type="string">"Click Here"</caption>
> > <left type="int">50</left>
> > <right type="int">100</right>
> > <top type="int">80</top>
> > <bottom type="int">100</bottom>
> ></button>
According to your taste, you can weight these general rationale and
come to your own decision--
1) Attributes are really shorthand so that you don't need complex
content models, and to allow a measure of stronger typing in particular
for ID and IDREF attributes. This suggests it doesn't matter which you
use: you don't have a complex content model and you the value attribute
is just CDATA.
2) The content is the thing primarily described by the GI. So an empty
element with an attribute called "value" is always an over-elarabrate
design. This suggest you should use Option 2.
3) The content of an element is the text that a dumb browser that is not
aware of your document type will display it. Therefore the text
should be in the nature of an alternative string for guidance. So
<caption> should be content, and <left> etc should use attributes.
4) You may at some future stage want to extend how <caption>,
<left>, etc work. So option 1 leaves you free to define a content
model later, for some other functionality.
5) Using a value attribute is more familiar to HTML people who
like the meta tag.
You should also consider:
<button
left="50"
right="100"
top="80"
bottom="100">
"Click Here"</button>
The XML element type declaration for this is:
<!ELEMENT button (#PCDATA) >
<!ATTLIST button
left CDATA #REQUIRED
right CDATA #REQUIRED
top CDATA #REQUIRED
bottom CDATA #REQUIRED >
I hope this is some help.
Rick Jelliffe
xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@ic.ac.uk)
|