XML Namespaces

lchyi

Senior member
May 1, 2003
935
0
0
I keep reading tutorials but I think I'm still confused on what XML namespaces are supposed to do.

So here's what I understand so far:

Made up XML tags sometimes conflict with other understood tags like if you're describing <table> as a piece of furinture and it could conflict with <table> the html tag. So you put a prefix <furniture:table xmlns:furniture="http://anandtech.com/namespaces"> and then use the table tag with the furniture prefix to distinguish it so: <furniture:table>IKEA Modern Coffee Table</table>.

Do I got the right idea or am I totally off. I mean why'd they choose to use URI names? Couldn't they use some kind of generated code or user made up namespaces?
 

UCJefe

Senior member
Jan 27, 2000
302
0
0
Yep, that's about right. Namespaces are just ways to scope your elements so they don't conflict with other people. URI's are used because that's what the standard says to use. There' s really no magic reason. A lot of people actually put information about the namespace at the URI location.

There's nothing really fancy going on and it sounds like you pretty much understand it.