[Home] [By Thread] [By Date] [Recent Entries]
When I was working as a consultant in the past I actually was recommending to use attributes and not element children -- whenever possible. Cheers, Dimitre. On Fri, Mar 2, 2012 at 7:51 AM, Dimitre Novatchev <dnovatchev@g...> wrote: > On Fri, Mar 2, 2012 at 7:51 AM, Dimitre Novatchev <dnovatchev@g...> wrote: >> I don't find a single confincing argument listed. >> >> Actuallu, in most cases using attributes appropriately, *simplifies* >> an XML document. >> >> Not to speak that for big documents the savings in memory may be dramatic. >> >> Cheers, >> Dimitre Novatchev >> >> On Fri, Mar 2, 2012 at 5:51 AM, Costello, Roger L. <costello@m...> wrote: >>> Hi Folks, >>> >>> 1. Â XML attributes are specific to the XML data format. Other data formats, Â such as >>> Â Â comma-separated values (CSV) and binary, don't have it. That is, taking a (element) >>> Â Â name with a (element) data value and then adding to that a (attribute) name/value >>> Â Â pair is specific to XML. >>> >>> 2. Â Avoiding XML attributes makes your language simpler. >>> >>> 3. Â When people use XML attributes they typically assign them some meaning. For example, >>> Â Â some people assign attributes the meaning "attributes are metadata." When you enter >>> Â Â the land of meaning (and its partner, interpretation) you enter the land of chaos [1]. By >>> Â Â eliminating attributes you have one less category of things to give meaning to and one >>> Â Â less category of things to be misinterpreted. >>> >>> 4. Â XML Schemas that do not use xsd:attribute can be used to logically model other data >>> Â Â formats besides XML, using the Data Format Description Language (DFDL) [2]. >>> >>> 5. Â Attributes are never needed. For example, >>> >>> Â Â Â Â Â The altitude is 12000 feet. >>> >>> Â Â can be modeled using an attribute: >>> >>> Â Â Â Â <altitude units="feet">12000</altitude> >>> >>> Â Â However it can be equivalently modeled using just elements: >>> >>> Â Â Â Â <altitude> >>> Â Â Â Â Â Â <units>feet</unit> >>> Â Â Â Â Â Â <value>12000</value> >>> Â Â Â Â </altitude> >>> >>> 6. Â Michael Kay says that attributes are unnecessary [3]: >>> >>> Â Â Â XML is too large. Attributes are unnecessary, mixed content is >>> Â Â Â unnecessary, namespaces are unnecessary: without these unnecessary >>> Â Â Â concepts, XSD and many other things would have been much simpler. >>> >>> >>> Are there any more reasons not to use XML attributes? >>> >>> /Roger >>> >>> [1] http://www.xfront.com/The-edge-of-chaos-where-syntax-ends-and-interpretation-begins.pdf >>> >>> [2] https://www.ogf.org/dfdl/ >>> >>> [3] http://lists.xml.org/archives/xml-dev/201112/msg00085.html >>> >>> >>> _______________________________________________________________________ >>> >>> XML-DEV is a publicly archived, unmoderated list hosted by OASIS >>> to support XML implementation and development. To minimize >>> spam in the archives, you must subscribe before posting. >>> >>> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/ >>> Or unsubscribe: xml-dev-unsubscribe@l... >>> subscribe: xml-dev-subscribe@l... >>> List archive: http://lists.xml.org/archives/xml-dev/ >>> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php >>> >> >> >> >> -- >> 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 >> ------------------------------------- >> Facts do not cease to exist because they are ignored. >> ------------------------------------- >> I finally figured out the only reason to be alive is to enjoy it. > > > > -- > 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 > ------------------------------------- > Facts do not cease to exist because they are ignored. > ------------------------------------- > I finally figured out the only reason to be alive is to enjoy it. -- 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 ------------------------------------- Facts do not cease to exist because they are ignored. ------------------------------------- I finally figured out the only reason to be alive is to enjoy it.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |

Cart



