Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can some one explain me several namespace usage in xml header?

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post.
I can not understand one part of the following code snippet, I performed some search but I do not know whether my understanding is correct or not.


I can not understand what the following line

means when we have another similar line

in the code.


Thanks.
 
Paul Clapham
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by raminaa niilian:

I can not understand what the following line

means

That means that the default namespace's URI is "http://rogers60.com/xmltutorial/2". Every element in the document whose name has no prefix is in that namespace, unless it's specifically declared to be in some other namespace.
when we have another similar line

in the code.
That second line doesn't change the meaning of the first line at all. It means that every element and attribute in the document whose name has the prefix "pub:" is in the namespace whose URI is "http://rogers60.com/xmltutorial/2".

You may find it confusing that elements whose names have the prefix "pub:" and elements whose names have no prefix are both in the same namespace, but that's what it means if both those declarations are in the document. However the default namespace doesn't apply to attributes whose name has no prefix, so the two declarations affect attributes differently.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic