Request for advice defining an XML based syntax

Mike Dierken mike at datachannel.com
Wed Aug 27 18:07:31 BST 1997


I also have some (philosophical) questions about elements and attributes in XML.

Rick J's point:
> 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.

made a lot of sense for me. I think, however, that John G's application of XML
is such that the properties of objects 'are' the content, and therefore it's not required 
for other viewers to skip that information.

I would like to hear some pro's & con's about the following four styles 
(continuing John Gossman's example):

1 Attributes within element
<button top=20 left=20 bottom=40 right=100>
<caption>Click me!</caption>
</button>

2 Attributes as single specific sub-element
<button>
<region top=20 left=20 bottom=40 right=100 />
<caption>Click me!</caption>
</button>

3 Attributes as several specific sub-elements 
NOTE: the properties of the button are stored as in style 1 (i.e. within the element) so 
other viewers can skip them.
<button>
<top value=20/>
<left value=20/>
<bottom value=40/>
<right value=100/>
<caption>Click me!</caption>
</button>

4 Attributes as several generic sub-elements
NOTE: The properties of the button are stored as content, since the document is 
intented to be storage for objects & their properties (i.e. the properties 'are' the content).
<button>
<prop name="top">20</prop>
<prop name="left">20</prop>
<prop name="bottom">40</prop>
<prop name="right">100</prop>
<caption>Click me!</caption>
</button>


In addition I have two questions about elements and attributes.
1. Generic tag with 'type' attribute
When should you use a generic <object type="button"> versus a specific <button>:
generic:
<object type="button>
Click this!
</object>

specific:
<button>
Click this!
</button>

2. Attributes as sub-element(s) 
When should you move attributes to a sub-element:

as attributes:
<button top=20 left=20 bottom=40 right=100>
</button>

as sub-element:
<button>
<region top=20 left=20 bottom=40 right=100 />
</button>



xml-dev: A list for W3C XML Developers
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To unsubscribe, send to majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa at ic.ac.uk)




More information about the Xml-dev mailing list