Declared XML Namespace(s) - is this corrct?

Hi. First post here. First of all I've been looking for an active forum to post this question on thought I'd try here.

I have to create an XML file that stores music and video recordings. Some of the music and video recordings have the same attributes such as title, category etc so I have created a namespace(s) to distinguish between them.

I thought what I had done was correct till I started to work on the Schema to validate the document.

This is the working version so far: (only one music/video recording shown, more in actual file)

<library>

<item xmlns="http://www.w3.org/music" recId="2040" imageName="nin_prettyhatemachine.gif" numTracks="10">

<artist>Nine Inch Nails</artist>

<title>Pretty Hate Machine</title>

<category id="5">Rock</category>

<price>13.99</price>

<songs>

<track id="468" duration="230">Head Like A Hole</track>

<track id="469" duration="211">Terrible Lie</track>

<track id="470" duration="180">Down In It</track>

<track id="471" duration="255">Sanctified</track>

<track id="472" duration="244">Something I Can Never Have</track>

<track id="473" duration="202">Kinda I Want To</track>

<track id="474" duration="205">Sin</track>

<track id="475" duration="180">That's What I Get</track>

<track id="476" duration="221">Only Time</track>

<track id="477" duration="250">Ring Finger</track>

</songs>

</item>

<item xmlns="http://www.w3.org/video" recId="3004" imageName="disco_godfather.gif" duration="5580">

<director>J. Robert Wagoner</director>

<title>Disco Godfather</title>

<category id="0">Action and Adventure</category>

<rating>R</rating>

<year>1993</year>

<price>23.99</price>

<actors>

<actor id="23" name="Rudy Ray Moore"></actor>

<actor id="24" name="Carol Speed"></actor>

<actor id="25" name="Jerry Jones"></actor>

<actor id="26" name="Lady Reed"></actor>

<actor id="27" name="Jimmy Lynch"></actor>

</actors>

</item>

</library>

I then thought that instead of <item xmlns="http://www.w3.org/video"

it should be ><music xmlns="http://www.w3.org/music" .. > for music

and <video xmlns="http://www.w3.org/video" .. > for video.

Clarification on which is the right way to do this would be appreciated, bearing in mind I have to create a Schema to validate this next.

[2835 byte] By [kevpa] at [2007-11-26 21:43:24]
# 1

It'll be easier if you a single namespace, rather than one for music, video, etc. Besides those elements are already distinguished by their names. An XML schema is tied to a particular namespace, so multiple namespaces means multiple schemas. Since this is all part of a single library, a single schema for the library would make sense.

spericasa at 2007-7-10 3:30:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

And by the way, namespaces are supposed to be URIs that are controlled by the organization assigning said namespace URIs. So it would be okay for the W3C to declare the namespace "http://www.w3.org/video" but not for you -- unless you're doing it on behalf of the W3C. So you should choose a URI that is owned by your organization.

DrClapa at 2007-7-10 3:30:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
Thanks for the reply, I understand the concept must better now. So using something like record or item instead of music and video would be better?Also, I will change the URIs to something else.Message was edited by: mekevp
kevpa at 2007-7-10 3:30:20 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...