[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: "Rick Jelliffe" <ricko@a...>
  • To: "'xml-dev@i...'" <xml-dev@i...>
  • Date: Wed, 27 Aug 1997 09:47:40 +1000

option button in xml
 
> From: John Gossman <JohnGo@a...>
 
> >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@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.