Connecting Tech Pros Worldwide Forums | Help | Site Map

Which is better for transfer data: Attributes or Elements?

afshar
Guest
 
Posts: n/a
#1: Nov 1 '08
I want to use XML to import/export some data. My data is like a
database record like an employee information. I'm wondering which is
better to use: saving data in attributes or saving them in elements. A
typical XML may contain hundred to thousands of data. See following:

using elements:
....
<employee>
<name>john</name>
<age>45</age>
<salary>52000<salary>
</employee>
....

OR

using attributes:
....
<employee name="john" age="45" salary="52000">
....

?
Phil Jollans
Guest
 
Posts: n/a
#2: Nov 1 '08

re: Which is better for transfer data: Attributes or Elements?


I'm not an expert on XML, but by chance I just read the web page
http://www.firstobject.com/dn_xmlversioning.htm

You might find point 2 "Only use the data value of elements that are atomic"
interesting.

Phil


Peter Flynn
Guest
 
Posts: n/a
#3: Nov 1 '08

re: Which is better for transfer data: Attributes or Elements?


afshar wrote:
Quote:
I want to use XML to import/export some data. My data is like a
database record like an employee information. I'm wondering which is
better to use: saving data in attributes or saving them in elements. A
typical XML may contain hundred to thousands of data. See following:
This is an FAQ, see http://xml.silmaril.ie/developers/attributes/

///Peter
Closed Thread