[Date Prev] [Date Next] [Thread Prev] [Thread Next] Indexes: Main | Date | Thread | Author

Re: [ba-ohs-talk] Fwd: [xml-dev] Penance for misspent attributes


Title: Re: [ba-ohs-talk] Fwd: [xml-dev] Penance for misspent attributes
> "Another way of thinking about elements and attributes is to think of
> an element as a container. To reason by analogy, the contents of the
> container (water or milk) correspond to XML data modeled as
> elements. On the other hand, characteristics of the container (blue
> or white, pitcher or can) correspond to XML data modeled as
> attributes. Good XML style will, in some consistent way, separate
> each container's contents from its characteristics."

Try this concept ...
An element is declared as a schema container and its value is invariant from one document instance to another during execution. Whereas, an element's structure is composed of attributes that have variant value.
Sandy

> From: Eric Armstrong <eric.armstrong@sun.com>
> Reply-To: ba-ohs-talk@bootstrap.org
> Date: Thu, 16 May 2002 13:00:48 -0700
> To: ba-ohs-talk@bootstrap.org
> Subject: Re: [ba-ohs-talk] Fwd: [xml-dev] Penance for misspent attributes
> Resent-From: <klausner@cubicon.com>
> Resent-To: s.klausner@attbi.com
> Resent-Date: Thu, 16 May 102 15:59:34 EDT
>
> Dead on. Comments below.
>
> Jack Park wrote:
>
>> This post seems like a great way to think about elements and attributes.
>> Here's an example of using attributes for data:
>> <someTag name="Joe" age="33" />
>> Here's the same example using elements
>> <someTag>
>> <name>Joe</name>
>> <age>33</age>
>> </someTag>
>>
>>> From: "Simon St.Laurent" <simonstl@simonstl.com>
>>> To: xml-dev@lists.xml.org
>>> ...
>>> The problem with using attributes for data is that there is no direct
>>> way to associate metadata with attribute content.  There is a very easy
>>> direct way to associate metadata with element content - it's called
>>> attributes....
>>>
>>> ....it seems like many of the PSVI-representation difficulties
>>> could be relieved by a best practice of using elements for the
>>> information contained in a document and using attributes exclusively to
>>> provide additional information about the element.
>>>
>>> Separating markup from content - and putting attributes squarely in the
>>> markup side - seems like one means of at least alleviating the headache.
>
> To paraphrase his pithy summary:
>
> "Use elements for the information *contained* in a document
> and use attributes exclusively to provide additional information
> *about* those elements."
>
> This is basically the recommendation I put forward in Sun's XML
> tutorial, which has unfortunately become very difficult to find
> online. The truly persevering, howver, if they have fortified themselves
> with a big lunch, will have managed it to track it down to here
> http://java.sun.com/webservices/docs/ea2/tutorial/doc/IntroXML4.html#65003
>
> The relevant part of that discussion, under "Container vs. Contents" is
> this:
> "Another way of thinking about elements and attributes is to think of
> an element as a container. To reason by analogy, the contents of the
> container (water or milk) correspond to XML data modeled as
> elements. On the other hand, characteristics of the container (blue
> or white, pitcher or can) correspond to XML data modeled as
> attributes. Good XML style will, in some consistent way, separate
> each container's contents from its characteristics."
>
> It's been there for a couple of years now.
> (It's nice to be ahead of the curve once in a while.)
> :_)
>
>
>