[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Content v. attribute
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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|