This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Namespace related.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Namespace related.." Watch "Namespace related.." New topic
Author

Namespace related..

Eager Beaver
Ranch Hand

Joined: Feb 26, 2001
Posts: 187
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

Joined: Jan 07, 1999
Posts: 6920
"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.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
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.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Eager Beaver
Ranch Hand

Joined: Feb 26, 2001
Posts: 187
Frank,
Sorry for using the nick. I shall be careful not to use it the next time.
Rajendra Deshpande
Ranch Hand

Joined: Nov 24, 2000
Posts: 40
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.
 
GeeCON Prague 2014
 
subject: Namespace related..