avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <pe...@apache.org>
Subject Re: XML Conventions
Date Sun, 08 Sep 2002 04:05:30 GMT
On Sun, 8 Sep 2002 14:04, Peter Donald wrote:
> Hiya,
>
> I was wondering if anyone had any thoughts on the conventions we should use
> in our xml files. Essentially when should we use attributes and when should
> we use elements.
>
> One school of thought saids we always use attributes if the value can only
> appear once. The negative aspect of this is that you can get elements with
> massive numbers of attributes like
>
> <component
>    name="X"
>    impl="com.biz.X"
>    version="1.0.2"
>    displayName="The magnificent X"
>    description="X is a ...."
>    ...
>  />
>
> This is fairly common in document centric descriptors.
>
> Another school of though saids that you never use attributes. Like most of
> descriptors that come out of Sun. It is easier to extend, but this ends up
> with fairly verbose files like the following. The other problem is that if
> you want to validate using DTDs you end up with stupid names like
> <component-name> in an element <component> (see servlet/ejb descriptors for
> an example).
>
> <component>
>   <name>X</name>
>   <impl>com.biz.X</impl>
>   <version>1.0.2</version>
>    ...
> </component>
>
> The other pattern I have noticed is that some people prefer to store "meta"
> data about element as attributes while they store "content" data as
> elements.
>
> So any preferences among these alternatives? My current thinking is that we
> should probably go with the Sun-style (no attributes) just because it is
> more common in java world. Thoughts?

Or maybe we go with a mixed approach because that may be the most human 
readable?

-- 
Cheers,

Peter Donald
----------------------------------------
"Liberty means responsibility. That is 
      why most men dread it." - Locke
---------------------------------------- 


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message