[Home] [By Thread] [By Date] [Recent Entries]

  • From: "Costello, Roger L." <costello@m...>
  • To: "xml-dev@l..." <xml-dev@l...>
  • Date: Wed, 29 Feb 2012 13:07:45 +0000

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"

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"

Are attributes metadata?

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"

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.

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.

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

(3) Attributes are not metadata. 

Do you agree?

/Roger


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


Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member