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

Re: Content v. attribute

  • From: <david@m...>
  • To: "XML Developers' List" <xml-dev@i...>
  • Date: Mon, 26 Oct 1998 11:47:32 -0500 (EST)

what iscurrent account
Dave Winer writes:

 > I consider it a flaw of XML that it has two ways to do hierarchy,
 > one much more powerful than the other. In working with other
 > companies about formats you can get into endless meaningless
 > debates about whether it's better to use attributes or just stick
 > with <tag> structures. When I design XML forms for our own internal
 > applications, I have generally found that if I use attributes, I
 > end up regretting it and switch over to straight tag hierarchy. You
 > always have the option of adding a structure where a scalar used to
 > be when you go that way. With attributes, you're at the end of the
 > road, no way to have structure, so I agree with John Cowan
 > entirely, you never know what's coming down the road, so it's
 > better to leave some room on either side. Dave

There was a long-running debate in the old SGML world about whether
attributes should be allowed at all.  Personally, I like them --
although Len's point about my data being someone else's metadata is
well-received, I still want to have the choice to use

  <section id="foo">
  ...
  </section>

or

  <note security="confidential">Remember to close the panel.</note>

or

  <link href="http://www.megginson.com">Megginson Technologies</link>

rather than

  <section>
  <id>foo</id>
  ...
  </section>

or

  <note>
  <security>confidential</security>
  <text>Remember to close the panel.</text>
  </note>

or

  <link>
  <href>http://www.megginson.com</href>
  <label>Megginson Technologies</label>
  </link>

There are, of course, many cases where the latter examples are
preferable.

I agree with all of the posters that in general using elements rather
than attributes is a good design principle, but I do think that there
are useful data/meta-data distinctions to be made, even if they are
extremely fuzzy.

One of the reasons data people jump to attributes is the fact that

  <account number="345"
	   type="asset"
	   name="Accounts Receivable"
	   currency="usd"
	   status="current"
	   balance="34,569.35"/>

looks an awful lot like

  public interface Account
  {
    public abstract int getNumber ();
    public abstract int getType ();
    public abstract String getName ();
    public abstract String getCurrency ();
    public abstract boolean isCurrent ();
    public abstract float getBalance ();
  }

or

  create table Account (
    num int primary key,
    type int,
    name char(80),
    currency int,
    status bool,
    balance float
  );

It's not easy to start thinking differently.


All the best,


David

-- 
David Megginson                 david@m...
           http://www.megginson.com/

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/
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.