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

Re: Abandon the (mistaken) belief that XML attributesprovide "

  • From: James Fuller <james.fuller.2007@gmail.com>
  • To: "Costello, Roger L." <costello@mitre.org>
  • Date: Sat, 19 Mar 2011 16:53:55 +0100

Re:  Abandon the (mistaken) belief that XML attributesprovide "
On Sat, Mar 19, 2011 at 3:54 PM, Costello, Roger L. <costello@mitre.org> wrote:
> However, the XML specification makes no such claim about attributes providing "metadata". This is what the XML specification says:
>

with due respect to W3C specs, that doesn't preclude you encoding
metadata inside attributes ... I think the lack of a statement
probably reflects that it was best left implied what you do with
attributes instead of parochially instruct.

>  Attributes are used to associate name-value pairs with elements.

yes correct, this is a good definition ... but doesn't mean you can't
do foolish things like put escaped markup into an attribute ... when
teaching this stuff I find its good to also go through the rules of
atomization whenever speaking about attributes, it gives a flavor of
what else can go inside of an attribute.

> Thus, attributes don't provide data about an element's content. Attributes don't provide metadata.

I think its far too literal to interpret the lack of an explicit
statement to mean 'dont'

> Attributes are purely a syntactic construct.

unsure what you mean here, attributes are part of the Infoset and
other data models so in that sense its not purely syntax but yes we
could call all of XML as purely syntactic (after a few pints).

> If you abandon the belief that attributes provide metadata then it frees you to create XML designs based on the capabilities of the applications you use.
>

instead of stating absolutes I will provide a few follow on statements;

* proximity of metadata is pretty important, e.g. an attribute on an
element is pretty close together and implies its saying something
about the element and can be a useful container for such metadata. You
could just as easily encode metadata as a nested element but I can
think up some markup structures where having attributes encode this
stuff provides better performance then having to step into every
element and examine a child node (yes I would hope some processors
optimize these kind of things away)

* XML is generalist in nature, which is why we have things like RDF
which makes much more explicit statements about how to relate data in
terms of semantics (and metadata) ... that doesn't mean you can't make
a home brew XML markup language to use attributes to relate metadata

* I see this as a variant of the permathread 'elements vs attributes'
e.g. 'attributes vs everything else'  ... there is no conclusion to be
made here

as for best practice, I tend to use attributes in terms of preserving
some state information about the element (and enclosed data) and
typically the values will come from a constrained list of values or
well known range (like dates) others may disagree.

Jim Fuller


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.