XML Style question

Everything else that doesn't fall into one of the other PB categories.
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

XML Style question

Post by pdwyer »

I guess this is a common question for a noob to creating XML files regarding when to use nodes and when to use attributes

To take a simple example, lets say I have a little database of books. So in my Root Node I create a node called "Book List" then in there create a new node for each book ("Book" Nodes)

Now in each book node I want "Author", "Title", "Cover Blurb" and "Cost"

Should these be four different nodes in each book with text set appropriately, or should they be four attributes? What would guide my decision? If the blurb was several paragraphs long would that effect the decision?

I can see why you might have an attribute on booklist at a higher level, maybe date created etc as I only want book nodes in the booklist but when it comes to the books... :?:

Is this just personal preference or are there limitations I should be aware of?
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

Well sp[eaking generally, XML has many limitations. Some are necessary.

Most of the XML info sheets I have seen on the web are frustrating and all written like bad doctoral dissertations on the subject. Too much whitesheet crud in the way of a good XML syntax tutorials...

http://www.w3schools.com/Xml/default.asp

POints you in a good direction! :D

@Paul: Still waiting for you to take me on in Bowling Buddies!
:wink:
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Little John
Addict
Addict
Posts: 4876
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Post by Little John »

Hi,

here is a quick answer ( which tells us that there is no definite answer :-) ).

Regards, Little John
User avatar
pdwyer
Addict
Addict
Posts: 2813
Joined: Tue May 08, 2007 1:27 pm
Location: Chiba, Japan

Post by pdwyer »

Thank you both, this is basically what I was after. :)

@Rook, I saw your invite to that and other wierd and wonderful things :) but when I clicked on it I got all sorts of security warnings about the fact that it opens your profile to X, Y and Z etc. I got spooked and figured your were getting carried away with your new toy :P
Paul Dwyer

“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Post by Rook Zimbabwe »

It really doesn't... it lets the game look at your fiends list... er... friends list and that is all... some of those things ask you to invite firends but near the bottom there is ALWAYS a place to click marked skip (though sometimes in very small letters...)

I have gotten NO spam in my email from it. I think the company that coded bowling buddies is concerned about your info as well.

Try this one. ; )
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
Post Reply