Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Namespace related..

 
Eager Beaver
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith,
Consider this from the Namespace link provided by you....
<foo:A xmlns:foo="http://www.foo.org/">
<B foo:C="foo" D="bar"/>
</foo:A>
The element type name A and the attribute name C are in the http://www.foo.org/ namespace because they are mapped there by the foo prefix. The element type name B and the attribute name D are not in any XML namespace because no prefix maps them there. On the other hand, the elements A and B and the attributes C and D are not in any XML namespace, even though they are physically within the scope of the http://www.foo.org/ namespace declaration. This is because XML namespaces contain names, not elements or attributes.

I am a bit confused here. Could you kindly explain the comment in bold. If everything within the scope of namespace declaration is only name then why is 'B' being referred to as element B.

 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Eager Beaver",
The name you have chosen is acceptable for use in the "Meaningless Drivel" forum, but we have a naming convention for our main forums, described at http://www.javaranch.com/name.jsp . We strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't blame you. It is indeed confusing. Let me try..
XML namespaces contain names, not elements or attributes. Any qualified name that has a colon prefix belongs to a namespace. The identifier immediately preceding the colon is the name of the namespace.
It is important not to get confused between names, elements and attributes. Every element has a name and an optional attribute list. The word "element" refers to everything that lies between the < and />, including the name. An element name on the otherhand is just an identifier that uniquely identifies one or more elements within a context.

 
Eager Beaver
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank,
Sorry for using the nick. I shall be careful not to use it the next time.
 
Rajendra Deshpande
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith,
Kindly consider the following in quotes....
posted by Eager
On the other hand, the elements A and B and the attributes C and D are not in any XML namespace

your response
Any qualified name that has a colon prefix belongs to a namespace


Is there a subtle difference between the phrases 'in a XML namespace' and 'belonging to a XML namespace'. If not then attribute C which has been aptly qualified as foo:C should belong to the namespace.
thanks & regards,
Rajendra.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic