[tcs-lc] Question about XML attribute vs. element
Bob Morris
ram at cs.umb.edu
Mon Mar 21 16:09:29 PST 2005
In general, some of this comes down to taste and practice. Among the
differences are that attributes (a) must be unique within a given
element (b)must be of simple type (technical term; in practice, it means
no structure) (c) have indeterminate order, no matter what the order
appears to be in the file. The last is a slight oversimplification but
you should expect that applications need not deliver attributes in the
order they are in the file, and may even rearrange them without being
justly accused of changing the file.
Almost anything by Elliotte Rusty Harold is worth reading. See
http://www.cafeconleche.org/slides/sd2004west/xmlfundamentals/
for discussions of this and other questions and see
http://www.cafeconleche.org/ for lots of other neat stuff about XML
technologies.
Bob
Richard Pyle wrote:
> What is the basic rule for when to designate something as an attribute,
> rather than a separate element, in an XML schema?
>
> Specifically, I'm thinking about "NomenCode" in TCS v095. Right now, it
> appears as an element within NameDetailed. But why couldn't/shouldn't it be
> represented instead as an enumerated attribute of NameDetailed?
>
> Aloha,
> Rich
>
>
> _______________________________________________
> tcs-lc mailing list
> tcs-lc at ecoinformatics.org
> http://www.ecoinformatics.org/mailman/listinfo/tcs-lc
--
Robert A. Morris
Professor of Computer Science
UMASS-Boston
http://www.cs.umb.edu/~ram
phone (+1)617 287 6466
More information about the Tcs-lc
mailing list