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

Re: Do attributes have scope? Are attributes metadata?

  • From: David Carlisle <davidc@nag.co.uk>
  • To: xml-dev@lists.xml.org
  • Date: Wed, 29 Feb 2012 13:21:46 +0000

Re:  Do attributes have scope?  Are attributes metadata?
On 29/02/2012 13:07, Costello, Roger L. wrote:
> Hi Folks,
>
> Do attributes have scope?
>
> Consider this:
>
> <Document classification="unclassified"> <Para>...</Para>
> <Para>...</Para> <Para>...</Para> </Document>
>
> (1) Is it correct to say, "The scope of the classification attribute
> is from the Document start-tag to its end-tag" or, more casually,
> "The Document and its content are unclassified"

This is entirely attribute and application specific. From an XML point
of view the answer is clearly no, XML says nothing much about what
attributes mean, only that they may appear in that position, so it is
not even the case that the attribute "applies" to the classification
element let alone its children.

Consider (x)html the scoping rules of

<p id="en">aaaa <b>bbbb

and


<p lang="en">aaaa <b>bbbb

are entirely different,

and since


<p wibble="en">aaaa <b>bbbb

isn't defined that could mean anything (or nothing)


>
> Conversely, consider the same document where the attribute is
> replaced with a namespace declaration:
>
> <Document xmlns="http://www.example.org"> <Para>...</Para>
> <Para>...</Para> <Para>...</Para> </Document>
>
> (2) Is it correct to say, "The scope of the namespace declaration is
> from the Document start-tag to its end-tag"

Yes (more or less). The namespace rec does define which elements are
affected by the namespace declarations.
>
> Are attributes metadata?

That is language an application specific (even if you could define
metadata in any meaningful way globally)

>
> Consider this:
>
> <altitude units="feet">12000</altitude>
>
> (3) Is it correct to say, "The units attribute provides metadata
> about the altitude element's value" or, more casually, "The attitude
> is 12000 feet"

that I would say is a classic instance where it is _not_ metadata.
the units are as much a part of the value as the numerical part.

>
> I will attempt to answer my questions.
>
> First, the XML specification defines attributes as:
>
> Attributes are used to associate name-value pairs with elements.
>
> Wow!
>
> That's all. It says nothing about scope or metadata.

XML is all about syntax.

>
> Second, the Namespace specification *does* talk about scope:
>
> ... these declarations are scoped by the elements on which they
> appear ...
>
> So, here are my answers to my questions:
>
> (1) Attributes do not have scope.

XML is just syntax. Languages defined to use XML syntax may use
attributes for things with scope. lang for example.
>
> (2) Namespace declarations *do* have scope. In the example above,
> the scope of the http://www.example.org namespace is from the
> Document start-tag to its end-tag.

yes

>
> (3) Attributes are not metadata.

attributes are just syntax. Attributes may be used to store any kind of
information, some of which may be considered as metadata by some people
in some circumstances.
>
> Do you agree?
>
> /Roger
>

David

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 
________________________________________________________________________


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