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

Re: Attributes v Elements

  • From: Duane Nickull <duane@x...>
  • To: vdv@d..., xml-dev@l...
  • Date: Thu, 17 May 2001 04:14:08 -0700

v elements
> This rule sounds nice, but I wonder where it comes from (I don't
> remember anything of that tone in the recommendation) and if the
> restrictions on elements do not alter it.
>>>>>>>>>>>
It comes from years of SGML and although you are technicall correct that XML
"... does not constrain the semantics, use, or (beyond syntax) names of the
element types and attributes.."  I think that both common sense and common
practices both point in that direction.  Also,  XMI and UML also heavily
weigh in the representation of objects (not scoped to programming objects)
by this use of elements and attributes.

XML 1.0 also does not recommend against the use of mixed content but I think
you will also find that in general the best practice is to avoid it.

As far as the use of Attributes,  I quote from XML 1.0:

"Attributes are used to associate name-value pairs with elements. Attribute
specifications may appear only within start-tags and empty-element tags;
thus, the productions used to recognize them appear in 3.1 Start-Tags,
End-Tags, and Empty-Element Tags. Attribute-list declarations may be used:
  a.. To define the set of attributes pertaining to a given element type."

My interpretation of this means that an Attribute must have some special
meaning to the Element that contains it.  The syntax associates attribute
directly with elements.  You would not often use an attribute as a stand
alone part of an XML document.  This is simply not common sense.  Using
<value> is meaningless semantically unless you know what it referes to.  If
modelled properly,  there is an association with another item.  A UML model
will show the relationship of that association and if there is a dependancy,
it can represent that.

> What if your adjective has a structure and needs mixed content ?

I am unclear of what you are referring to.  An adjective which describes a
unique property of an element does not have any structure other than the "
name='value' " bestowed upon it by XML 1.0 syntax constraints.

> What if your adjective can have several values ?

enumerated lists.

> What if the order between your adjectives is significant ?

That is a not a function of XML itself.  That is a requirement of a handler
written to make use of what the parser returns.  Sure people may argue that
XML DTD's are needing additional functionality here but I belive if your XML
is modelled corectly,  it should not ever be the case.  Can you provide an
example where the document instance itself has a critical need to have
attributes appear in a certain order (not the end user of the document).

Cheers!

Duane Nickull



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.