XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] Why does XML call them "attributes" and not name-value pairs?

Attributes are different from the rest of XML in that ordering doesn't matter. 

At one point a really long time ago I got all negative about there being two ways of doing things and decided to use attribute-free markup (this was before XML I think).  But then the WWW came along and I saw <a href="" text</a> and thought that was elegant and minimal and expressive, so I shut up.

On Sat, Jan 15, 2022 at 5:37 PM Rick Jelliffe <rjelliffe@allette.com.au> wrote:
Attributes are a modelling capability, not an analysis. That we can choose what they are used for is not a weakness but a strength.

Saying that we could get rid of attributes and use elements misses the point as much as would saying we could get rid of object-oriented features from Java, _javascript_, C++, and so on.  Yes we could, but it would not make life easier in most cases. 

This "syntactic sugar" reduces the gap between problem analysis and representation. In particular, for documents there is an obvious distinction between data content and metadata: if we want to make this explicit for prudent reasons, using attributes is entirely practical and prudent. 

But attributes are not syntactic sugar. If you could only use elements, you would then have to provide some extra markup to state they are like attributes. For example, if XPath did not allow attributes, you could not have ./child::* but  ./child::*[not(metadata/type="i am an attribute")]

Just like comments and PIs, attributes simplify access to strongly-connected immediate downward nodes because they are preclassified.

Cheers
Rick



On Sun, 16 Jan 2022, 6:38 am Stephen D Green, <stephengreenubl@gmail.com> wrote:
When distinctions are vague and debatable, do they really need to be represented in XML in such markedly distinct ways? An attribute being so different to an element (attribute sets, nuances of relationship to the element, etcetera) is a bit of a stumbling block or pain point for those learning XML: Not so much as namespaces, but irksome nonetheless. If it is vague and uncertain what an attribute actually is and how it differs from what an element actually is, could they have been merged, say, to reduce complexity of the specification of XML? It is a contrast point with JSON, isn’t it? 

On Sat, 15 Jan 2022 at 19:13, Tim Bray <tbray@textuality.com> wrote:
Argh, next we'll be arguing about data vs metadata.  I concluded decades ago that the distinction is at best not useful but probably not even real.

On Sat, Jan 15, 2022 at 11:10 AM Dimitre Novatchev <dnovatchev@gmail.com> wrote:
>  Is a disease a thing, or an attribute of a thing?

OK, let me try to put it in another way. I think that an attribute contains a "fact", or a "statement" about a particular object.

An attribute's value is not a structured object (although it can contain the serialization of an object as a flat string), and it is meaningless for an attribute to have two separate instances (because they will be stating the same fact or property twice).

So, an attribute is not a structured object but is always a property of an object, which property is not itself an object.

Thanks,
Dimitre

On Sat, Jan 15, 2022 at 10:06 AM Michael Kay <mike@saxonica.com> wrote:
>
> So the color of one's hair is more of an attribute, but the hair itself, or any organ, such as heart, liver or lung, is an "element"
>
> Any objections to this?
>


I'm afraid so. Philosophers have devoted their lives to these questions, and even in the more mundane world of data modelling, many books have been written.

Since you've chosen the human body as your subject area, consider disease. Is a disease a thing, or an attribute of a thing? Is there an absolute answer to this question, or is it an engineering choice in how we model it?

Perhaps every attribute is a relationship of one thing to another. Hence RDF triples.

Michael Kay
Saxonica


--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.
 
--
----
Stephen D Green


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


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS