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

RE: Attr+: Integrating attributes and elements

  • From: Marc.McDonald@D...
  • To: xml-dev@i..., paul@p...
  • Date: Fri, 20 Aug 1999 15:52:19 -0700

xpath not attribute
I would say the key advantage of attributes over elements is that attributes
can have defaults. I can define a set of elements to be optional and allowed
in any order by using (Attr1 | Attr2 ...)*. With schemas, I can type the
content of an element. Default values seem the only missing capability.


Marc B. McDonald
Principal Software Scientist
 <<...>> 
Design Intelligence, Inc.
1111 Third Avenue, Suite 1500
Seattle, WA  98101
marc.mcdonald@d...
Ph: 206.343-7797
Fax: 206.343.7750

http://www.design-intelligence.com


> ----------
> From: 	Paul Prescod[SMTP:paul@p...]
> Sent: 	Friday, August 20, 1999 8:56 AM
> To: 	w3c-xml-schema-ig@w...; www-xml-schema-comments@w...; xml-dev
> Subject: 	Attr+: Integrating attributes and elements
> 
> This proposal goes one step beyond the one in "&-compromise". It goes a
> step farther towards making XML behave as a property/value language like
> most "OO" languages.
> 
> One of the hardest questions to answer about XML DTD design is:
> "element  or attribute." Attributes have certain virtues relating to
> lexical typing and convenience and elements have the primary virtue of
> being able to contain sub-structure.
> 
> XML schemas are set to reduce some of the benefits of attributes but not
> all. Attributes will continue to be more convenient because they can
> come in any order and because they are easier to type.
> 
> The problem is: if you choose to represent something as an attribute,
> for user convenience and "intuitiveness," you can never change your mind
> and allow it to have substructure later.
> 
> I propose a new concept called a "structured attribute" (attr+). An
> attr+ is a property of an element. In most respects it is just like an
> attribute. In fact, not much in the schema spec would change at all.
> 
> Am attr+ is different in that it can be syntactically fulfilled in a
> document by EITHER an XML 1.0 attribute OR a sub-element element of the
> same name. All such elements must precede the "real content" of an
> element. All characteristics must have names that are different from any
> element type name allowable in the element. A processor knows it has
> shifted from processing characteristics to processing "content elements"
> merely by looking at the generic identifiers ("tag names", for
> DOM-heads).
> 
> Let me be clear that there is no new syntax in the document instance. A
> characteristic "foo" of type "IDREF" on element "bar" can be expressed
> as:
> 
> <bar foo="abc">...</bar>
> 
> or
> 
> <bar><foo>abc</foo>...</bar>
> 
> Attr+es can have full content models. If a particular instance of a
> characteristic on a particular element happens to be all text (no
> sub-elements) then it can be expressed as an attribute instead of as an
> element. Over time, the word "attribute" would come to be synonymous
> with the term "characteristic in the minimized syntax."
> 
> The working group can decide whether to keep the concept of "classic
> attribute" alive in the schema -- perhaps for backwards compatibility. A
> classic attribute would be an Attr+ that is constrained to only the
> minimized syntax. You could have an attribute called "StringOnly" or
> something. This would be useful for backwards compatibility. Attr+es
> would give these attributes "a future" in that they could become
> structured later.
> 
> The information set contribution of an attr+ would be an information set
> item just like an Attribute information item except that its value would
> be an arbitrarily sub-strucured node list instead of just references and
> characters as it is now. An extra property would specify whether the
> attribute+ was expressed syntactially as an element or as "classic
> attribute." 
> 
> Practically speaking, this means that the XPath @foo could return a node
> with elements as its children. Thanks to the XPath concept of "value",
> this is 100% backwards compatible. Given
> <foo>abc<emph>def</emph>ghi</foo>, @foo would return "abcdefghi" in any
> context expecting a string and the structured content anywhere else.
> 
> It is debatable whether attr+es would show up in the information set as
> element content (or in the child:: axis of XPath). Having them NOT show
> up is probably more convenient because why would they be in two axes? On
> the other hand, this means that schema-using processors would see a very
> different information set than XML 1.0 processors. That may or may not
> be a "big deal." It depends on how much the information set is otherwise
> modified by XMLSchema (archetypes, datatypes etc.).
> 
> There are various ways of making the information set backwards
> compatible and yet making it easy to filter "true content" from
> "attribute content."
> 
>  Paul Prescod
> 
> xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
> Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on
> CD-ROM/ISBN 981-02-3594-1
> To (un)subscribe, mailto:majordomo@i... the following message;
> (un)subscribe xml-dev
> To subscribe to the digests, mailto:majordomo@i... the following
> message;
> subscribe xml-dev-digest
> List coordinator, Henry Rzepa (mailto:rzepa@i...)
> 

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo@i... the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto: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.