Re: Gnome-Bugs and SMTP
- From: James Henstridge <james daa com au>
- To: Ali Abdin <ALIABDIN aucegypt edu>
- cc: gnome-devel-list gnome org
- Subject: Re: Gnome-Bugs and SMTP
- Date: Wed, 10 Nov 1999 18:16:02 +0800 (WST)
This is a bit of a difficult question. Part of it is up to whoever is
writing the XML schema (ie. the set of allowable tags for an XML
document). There are cases where you definitely don't want to use
attributes.
If the data you are trying to represent may have multiple values, you will
almost always want to use elements rather than attributes. Also, if you
want to provide translations for a piece of data, you would have to use
elements:
<description>Some description for the default locale</description>
<description xml:lang="fr">French version of above</description>
If the data is going to be free form, people usually choose to use an
element rather than an attribute.
In other cases, it is up to you. The SVG specification is one that uses
attributes a lot (element content is hardly ever used), and current glade
format is one where element content is used exclusively.
It is usually helpful to think of an attribute as being some property of
the element it is associated with, or the content of that element.
As for your example, the second form looks better than the first. You
would usually think of the check as being associated with the package
rather than the name of the package. It may be nice to have name as an
attribute of the package element though.
James.
--
Email: james@daa.com.au
WWW: http://www.daa.com.au/~james/
On Wed, 10 Nov 1999, Ali Abdin wrote:
> Could you please put this somewhere on your website and provide a link :)
> That was a really helpful "crash" tutorial on XML and it really helped me
> understand XML more :)
>
> One thing is still confusing to me though - When would I use attributes
> as opposed to just 'nodes'? This is slightly confusing to me. What would
> be better to have ONE child inside a node or instead to have just one
> node with an attribute on it?
> For example
>
> [snip]
> <package>
> <name check="gnome-config --version">gnome-libs</name>
> </package>
> [snip]
>
> OR:
> <package>
> <name>gnome-libs</name>
> <check>gnome-config --version</name>
> </package>
> Also - could someone put this up at developer.gnome.org???
>
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]