element or attribute

Saturday, 27 December 2014 · 3 messages · last reply 29 Dec 2014
FG
Florent Gallaire27 Dec 2014 19:23 #
Hello, When creating a XML file for usage as database with BaseX, is there some policy about when it's good to use an element and when it's good to use an attribut ? Cheers, Florent
-- FLOSS Engineer & Lawyer
DK
Dirk Kirsten29 Dec 2014 11:33 #
Hello Florent, I don't think are are any general rules per se. Most people tend to prefer one over the other. I personally would use elements as much as possible as they are more flexible. You shouldn't use attributes if there is the slightest chance you might want to break up the value into smaller values. i.e. for age an attribute is ok, for a name I personally would use an element (as you might want to store first name, middle name, ... separately). From the database perspektive, there is not difference in speed whether you use an attribute or an element. So only the model of your data should be relevant to your schema. Cheers, Dirk
Quoted text · Florent Gallaire · 11 lines
On 12/27/2014 07:23 PM, Florent Gallaire wrote: > Hello, > > When creating a XML file for usage as database with BaseX, is there > some policy about when it's good to use an element and when it's good > to use an attribut ? > > Cheers, > > Florent >
-- Dirk Kirsten, BaseX GmbH, http://basex.org |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
FG
Florent Gallaire29 Dec 2014 16:13 #
Thanks a lot (again) for your answer. Cheers Florent
Quoted text · Dirk Kirsten · 28 lines
On Mon, Dec 29, 2014 at 11:33 AM, Dirk Kirsten <dk at basex.org> wrote: > Hello Florent, > > I don't think are are any general rules per se. Most people tend to prefer one over the other. I personally would use elements as much as possible as they are more flexible. You shouldn't use attributes if there is the slightest chance you might want to break up the value into smaller values. i.e. for age an attribute is ok, for a name I personally would use an element (as you might want to store first name, middle name, ... separately). > > From the database perspektive, there is not difference in speed whether you use an attribute or an element. So only the model of your data should be relevant to your schema. > > Cheers, > Dirk > On 12/27/2014 07:23 PM, Florent Gallaire wrote: >> Hello, >> >> When creating a XML file for usage as database with BaseX, is there >> some policy about when it's good to use an element and when it's good >> to use an attribut ? >> >> Cheers, >> >> Florent >> > > -- > Dirk Kirsten, BaseX GmbH, http://basex.org > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
-- FLOSS Engineer & Lawyer

⚡Generated with XQuery