[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Why does XML call them "attributes" and notname-value pairs?
- From: "Liam R. E. Quin" <liam@fromoldbooks.org>
- To: Roger L Costello <costello@mitre.org>, "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
- Date: Sat, 15 Jan 2022 14:31:29 -0500
On Sat, 2022-01-15 at 12:42 +0000, Roger L Costello wrote:
> Hi Folks,
>
> Someone once told me:
>
> Call it what it is.
> Don't invent some artificial name.
>
> The items in yellow:
>
> <Person name="John Doe" employer="Acme Inc." age="30">...</Person>
>
> are name-value pairs.
>
> Why does XML call them "attributes"?
No yellow here. But, they are not name-value pairs, because they do not
stand alone: they are associated with an element represented by start
tag, content, and end tag. Instead, as others have pointed out, they
represent attributes (properties) of that element.
Your example violates the principle expressed in B.1.2 of SGML, that
attributes qualify the generic identifier. To put it another way, a
good principle i've found in practice for documents is,
Attributes are for computers. Element content is for humans.
Section "4.4.3 Attributes" describes attributes as analogous to
declaring the type of a variable in a programming language.
So we could really have,
<Person id="person301">
<Name>Judith Doe</Name>
<Employer type="14">Acme Inc.</Employer>
<Age unit="years">30</Age>
...
</Person>
Consider what happens if the person's name is in Traditional Chinese
and the company name is Korean - now you need additional markup to
identify the language and script, so it can be processed and displayed
correctly - Unicode unification means you need to identify the
different writing systems being used. You can't do that in attributes.
So attributes are supposed to be properties of the element name and the
element itself, not of the thing represented. That RDF has difficulty
with this distinction doesn't mean we have to follow :-)
Liam
--
Liam Quin, https://www.delightfulcomputing.com/
Available for XML/Document/Information Architecture/XSLT/
XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
Barefoot Web-slave, antique illustrations: http://www.fromoldbooks.org
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]