[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] 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
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]