[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Request for advice defining an XML based syntax

  • From: mike@d... (Mike Dierken)
  • To: "'xml-dev@i...'" <xml-dev@i...>
  • Date: Wed, 27 Aug 1997 09:06:16 -0700

xml advice attribute element
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@i... the following message;
unsubscribe xml-dev
List coordinator, Henry Rzepa (rzepa@i...)


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.