XML Namespace

From Wikipedia, the free encyclopedia

(Redirected from XML namespaces)
Jump to: navigation, search

An XML namespace is a W3C recommendation for providing uniquely named elements and attributes in an XML instance. An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace then the ambiguity between identically named elements or attributes can be resolved.

All element names within a namespace must be unique.

A simple example would be to consider an XML instance that contained references to a customer and an ordered product. Both the customer element and the product element could have a child element "ID_number". References to the element ID_number would therefore be ambiguous unless the two identically named but semantically different elements were brought under namespaces that would differentiate them.

A namespace is declared using the reserved XML attribute xmlns, the value of which must be a URI (Uniform Resource Identifier) reference.

For example:

xmlns="http://www.w3.org/1999/xhtml"

Note, however, that the URI is not actually read as an online address; it is simply treated by an XML parser as a string. For example, http://www.w3.org/1999/xhtml itself does not contain any code, it simply describes the xhtml namespace to human readers. Using a URL (such as "http://www.w3.org/1999/xhtml") to identify a namespace, rather than a simple string (such as "xhtml"), reduces the possibility of different namespaces using duplicate identifiers. Namespace identifiers need not follow the conventions of web addresses, though they often do.

The declaration can also include a short prefix with which elements and attributes can be identified, e.g.:

xmlns:xhtml="http://www.w3.org/1999/xhtml"

An XML namespace does not require that its vocabulary be defined, though it is fairly common practice to place either a Document Type Definition (DTD) or an XML Schema defining the precise data structure at the location of the namespace's URI.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.