XML Style

H

howachen

which style you prefer?

a.

<Book>
<Title>...</Title>
<Author>...</Author>
</Book>

or

b.

<book>
<title>...</title>
<author>...</author>
</book>

or

c.

<Book>
<title>...</title>
<author>...</author>
</Book>


in case of multi-words, which one you perfer?


1.

<Person>
<fullName>...</fullName>
</Person>


2.

<Person>
<full_name>...</full_name>
</Person>
 
J

Joe Kesselman

Pick one consistent capitalization and word-delimiting rule and stick
with it for all elements. I recommend against options C and 2 for that
reason.

Other than that, this IS a matter of style and hence has no solid answer
in XML any more than in programming languages.
 
W

William

I prefer:

<Book>
<Title>...</Title>
<Author>...</Author>
</Book>
<Person>
<FullName>...</FullName>
</Person>

Reason? Readability. And years of getting used to spelling like that
while writing programs. Am already glad that I've learned to NOT use
the Hungarian notation anymore. :)

These things are mostly personal preferences. If you work for some
larger company, then try to detect the generic preference within that
company and follow their housestyle instead. But it's basically just
preference.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,002
Messages
2,570,261
Members
46,858
Latest member
FlorrieTuf

Latest Threads

Top