OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] Help needed in namespaces!

[ Lists Home | Date Index | Thread Index ]
  • To: "'Satish S'" <satish.s@hurix.com>, <xml-dev@lists.xml.org>
  • Subject: RE: [xml-dev] Help needed in namespaces!
  • From: "Doug Schepers" <doug@schepers.cc>
  • Date: Thu, 29 Sep 2005 04:09:11 -0400
  • In-reply-to: <20050928102528.3CB3913D999@sack.dreamhost.com>
  • Thread-index: AcXEFdjgf07crY6RTWOaebOdXvNDygAtLUAw

Hi, Sathish-
 
| Can any one tell me what the meaning of namespaces in XML and its use. 
 
The basic idea really easier than you might think. The metaphor I use is
that namespaces are the family name of an element or an attribute. You might
know 2 people named Joe, one at the office and one in your neighborhood.
Normally, it doesn't really matter what their family name is... The people
in the office know who you mean when you say, "Joe," and the people in your
neighborhood know who you mean when you talk about the other. But when you
are speaking to someone who knows both Joes, you have to clarify if you mean
"Joe Kramer" or "Joe Yu." In a document with only one namespace, there's
less need to specify which family (XML dialect) an element or attribute
belongs to, but when you mix elements or attributes from 2 different
families (dialects), you need to specify which ones belong to which family
(or dialect, or namespace). Since it's increasingly likely these days that
you will have mixed-namespace documents (also called Compound Documents),
it's a safe bet to always include all the namespaces used in the root of the
document.

A simple example might be a document with both HTML and FurnitureML, where
both of them have a <table> element. You would need to say <html:table .../>
or <furniture:table .../> to tell the UA (the browser) which one you mean.

Note that if the attributes of an element are in the same namespace as that
element, you do not need to preface them with the 'mynamespace:' prefix;
otherwise, you do.

I hope that's simple enough for you, and isn't too egregiously erroneous
that I offend someone else. ;)

Regards-
Doug

doug . schepers  @ vectoreal.com
www.vectoreal.com ...for scalable solutions.







 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS