Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question

Status
Not open for further replies.

pingu1no

Programmer
Aug 13, 2005
1
GB
Hi folks,

Sorry for the basic question, but I'm new to XML. I was just wondering if there was any difference between:

<database>
<table name = 'Sales'>
....
< /table>
< /database>

I mean, I know that the table will only have 1 name, so is it ok to use an attribute there? I've read lots of stuff about HOW to use elements and attributes, and very little on WHEN to use one or the other...

I'd appreciate any help!
 
Attributes are essentially the same as elements, except they are not extensible. It pretty much down to personal preference, although a general rule is that an attribute should relate to the information in the node where it appears. I would use elements where possible, unless an attribute seems to fit. The way you have used it is entirely appropriate.

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top