XML namespace

XML namespaces are used for providing uniquely named elements and attributes in an XML document. They are defined in a W3C recommendation.[1][2] An XML instance may contain element or attribute names from more than one XML vocabulary. If each vocabulary is given a namespace, the ambiguity between identically named elements or attributes can be resolved.

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 named id. References to the id element would therefore be ambiguous; placing them in different namespaces would remove the ambiguity.

Namespace names

A namespace name is a uniform resource identifier (URI). Typically, the URI chosen for the namespace of a given XML vocabulary describes a resource under the control of the author or organization defining the vocabulary, such as a URL for the author's Web server. However, the namespace specification does not require nor suggest that the namespace URI be used to retrieve information; it is simply treated by an XML parser as a string. For example, the document at http://www.w3.org/1999/xhtml itself does not contain any code. It simply describes the XHTML namespace to human readers. Using a URI (such as "http://www.w3.org/1999/xhtml") to identify a namespace, rather than a simple string (such as "xhtml"), reduces the probability of different namespaces using duplicate identifiers.

Although the term namespace URI is widespread, the W3C Recommendation refers to it as the namespace name. The specification is not entirely prescriptive about the precise rules for namespace names (it does not explicitly say that parsers must reject documents where the namespace name is not a valid Uniform Resource Identifier), and many XML parsers allow any character string to be used. In version 1.1 of the recommendation, the namespace name becomes an Internationalized Resource Identifier, which licenses the use of non-ASCII characters that in practice were already accepted by nearly all XML software. The term namespace URI persists, however, not only in popular usage, but also in many other specifications from W3C and elsewhere.

Following publication of the Namespaces recommendation, there was an intensive debate about how a relative URI should be handled, with some intensely arguing that it should simply be treated as a character string, and others arguing with conviction that it should be turned into an absolute URI by resolving it against the base URI of the document.[3] The result of the debate was a ruling from W3C that relative URIs were deprecated.[4]

The use of URIs taking the form of URLs in the http scheme (such as http://www.w3.org/1999/xhtml) is common, despite the absence of any formal relationship with the HTTP protocol. The Namespaces specification does not say what should happen if such a URL is dereferenced (that is, if software attempts to retrieve a document from this location). One convention adopted by some users is to place an RDDL document at the location.[5] In general, however, users should assume that the namespace URI is simply a name, not the address of a document on the Web.

Namespace declaration

An XML namespace is declared using the reserved XML attribute xmlns or xmlns:prefix, the value of which must be a valid namespace name.

For example, the following declaration maps the "xhtml:" prefix to the XHTML namespace:

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

Any element or attribute whose name starts with the prefix "xhtml:" is considered to be in the XHTML namespace, if it or an ancestor has the above namespace declaration.

It is also possible to declare a default namespace. For example:

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

In this case, any element without a namespace prefix is considered to be in the XHTML namespace, if it or an ancestor has the above default namespace declaration.

If there is no default namespace declaration in scope, the namespace name has no value.[6] In that case, an element without an explicit namespace prefix is considered not to be in any namespace.

Attributes are never subject to the default namespace. An attribute without an explicit namespace prefix is considered not to be in any namespace.

Namespaces in APIs and XML object models

Different specifications have taken different approaches on how namespace information is presented to applications.

Nearly all programming models allow the name of an element or attribute node to be retrieved as a three-part name: the local name, the namespace prefix, and the namespace URI. Applications should avoid attaching any significance to the choice of prefix, but the information is provided because it can be helpful to human readers. Names are considered equal if the namespace URI and local name match.

In addition, most models provide some way of determining which namespaces have been declared for a given element. This information is needed because some XML vocabularies allow qualified names (containing namespace prefixes) to appear in the content of elements or attributes, as well as in their names. There are three main ways this information can be provided:

  • As attribute nodes named "xmlns" or "xmlns:xxx", exactly as the namespaces are written in the source XML document. This is the model presented by DOM.
  • As namespace declarations: distinguished from attributes, but corresponding one-to-one with the relevant attributes in the source XML document. This is the model presented by JDOM.
  • As in-scope namespace bindings: in this model, the application is able to determine which namespaces are in scope for any given element, but is not able to determine which elements contain the actual declarations. This is the model used in XPath, XSLT, and XQuery.

See also

References

  1. ^ Bray, Tim; Dave Hollander; Andrew Layman; Richard Tobin; Henry S. Thompson (December 2009). "Namespaces in XML 1.0". W3C. Retrieved 9 October 2010.
  2. ^ "XML and Semantic Web W3C Standards Timeline (v.1.2)" (PDF).
  3. ^ Dodds, Leigh (24 May 2000). "News from the trenches". O'Reilly Media, Inc.
  4. ^ Connolly, Dan (11 Sep 2000), W3C XML Plenary decision on relative URI references in namespace declarations
  5. ^ Harold, Elliotte Rusty (20 Feb 2001). "RDDL Me This: What Does a Namespace URL Locate?". Archived from the original on 7 May 2017.
  6. ^ "Namespaces in XML 1.0 (Third Edition)". W3C. Retrieved 28 April 2017.

Read other articles:

Chamberlain com o Harlem Globetrotters circa 1959. Wilt Chamberlain estabeleceu o recorde de pontuação em jogo único da National Basketball Association (NBA) fazendo 100 pontos jogando pelo Philadelphia Warriors na vitória por 169 a 147 sobre o New York Knicks em 2 de março de 1962, na Hershey Sports Arena em Hershey, Pensilvânia. É amplamente considerado um dos maiores recordes no basquetebol. Chamberlain estabeleceu cinco outros recordes naquele jogo incluindo mais lances livres conv...

 

Kostolík Die Westwand des Kostolík Höhe 2262 m n.m. Lage Slowakei Gebirge Hohe Tatra Koordinaten 49° 9′ 42″ N, 20° 7′ 27″ O49.16166720.1241672262Koordinaten: 49° 9′ 42″ N, 20° 7′ 27″ O Kostolík (Slowakei) Der Kostolík (deutsch Kapelle, auch Kirchlein oder Kapellentürmchen, ungarisch Kápolna, auch Templomocska oder Koscielek, polnisch Kościołek)[1] ist ein 2262 m n.m. (nach ande...

 

يفتقر محتوى هذه المقالة إلى الاستشهاد بمصادر. فضلاً، ساهم في تطوير هذه المقالة من خلال إضافة مصادر موثوق بها. أي معلومات غير موثقة يمكن التشكيك بها وإزالتها. (ديسمبر 2019) هذه المقالة تحتاج للمزيد من الوصلات للمقالات الأخرى للمساعدة في ترابط مقالات الموسوعة. فضلًا ساعد في تحسي

 

село Мефодіївка Країна  Україна Область Миколаївська область Район Миколаївський район Громада Нечаянська сільська громада Код КАТОТТГ UA48060190050057366 Основні дані Населення 16 Поштовий індекс 57140 Телефонний код +380 512 Географічні дані Географічні координати 46°53′20″ пн...

 

أمريكا المفتوحة 1992 - فردي السيدات جزء من أمريكا المفتوحة 1992  البلد الولايات المتحدة  التاريخ 1992  الرياضة كرة المضرب  حامل(ة) اللقب مونيكا سيليش البطل(ة) مونيكا سيليش الوصيف(ة) أرانتشا سانتشيث فيكاريو النتيجة 6–3، 6–3 أمريكا المفتوحة 1991 - فردي السيدات  أمريكا المف�...

 

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (نوفمبر 2019) أبريل سميث معلومات شخصية الميلاد سنة 1949 (العمر 73–74 سنة)  البرونكس  مواطنة الولايات المتحدة  الحياة العملية المدرسة الأم جامعة بوسطنجامعة ستانفور�...

 

  لمعانٍ أخرى، طالع رودني (توضيح). هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (يوليو 2019) رودني معلومات شخصية الميلاد 1 يناير 1971 (52 سنة)  غرينويتش  مواطنة الولايات المتحدة  الطول 183 سنتيمتر  الوزن 110 ك�...

 

Пам'ятник Григорію Сковороді 50°16′35″ пн. ш. 31°45′50″ сх. д. / 50.27639° пн. ш. 31.76389° сх. д. / 50.27639; 31.76389Координати: 50°16′35″ пн. ш. 31°45′50″ сх. д. / 50.27639° пн. ш. 31.76389° сх. д. / 50.27639; 31.76389Статус Пам'ятка місцевого значення.К

 

Office building in Canary Wharf, London, England 5 Canada SquareGeneral informationStatusCompletedTypeCommercial officesArchitectural stylePostmodernLocationCanary WharfLondon, E14United KingdomCoordinates51°30′20″N 0°01′07″W / 51.505556°N 0.018611°W / 51.505556; -0.018611Construction started1999Completed2003HeightRoof87.70 m (287.7 ft)Technical detailsFloor count16Floor area46,450 m2 (500,000 sq ft)Design and constructionArchitect(...

 

Pour les articles homonymes, voir Soisy. Soisy-sous-Montmorency L'hôtel de ville. Blason Administration Pays France Région Île-de-France Département Val-d'Oise Arrondissement Sarcelles Intercommunalité CA Plaine Vallée Maire Mandat Luc Stréhaiano 2020-2026 Code postal 95230 Code commune 95598 Démographie Gentilé Soiséens Populationmunicipale 18 061 hab. (2020 ) Densité 4 538 hab./km2 Géographie Coordonnées 48° 59′ 00″ nord, 2° 18′&#...

 

1994 EP by Econoline CrushPurgeEP by Econoline CrushReleasedMay 3, 1994[1]GenreAlternative rock, industrial rockLabelEMI Music CanadaEconoline Crush chronology Purge(1994) Affliction(1996) Professional ratingsReview scoresSourceRatingAllmusiclink Purge is the first EP released by the industrial alternative rock band Econoline Crush. It was released in Canada in 1994 by EMI, and it garnered them a nomination for a Juno Award. Pssyche is a Killing Joke cover, the original being ...

 

Austrian political and racial theorist, occultist, and publisher Jörg Lanz von LiebenfelsJörg Lanz von Liebenfels.BornAdolf Josef Lanz(1874-07-19)19 July 1874Penzing district of ViennaDied22 April 1954(1954-04-22) (aged 79)NationalityAustrianOther namesLanz von LiebenfelsKnown forRacist and occult ideas Adolf Josef Lanz (19 July 1874 – 22 April 1954), also known under his pseudonym as fascist agitator Jörg Lanz von Liebenfels, was an Austrian political and racial theorist ...

 

Legislative Assembly constituency in Gujarat State, India GodhraConstituency for the Gujarat Legislative AssemblyConstituency detailsCountryIndiaRegionWestern IndiaStateGujaratDistrictPanchmahalLS constituencyPanchmahalTotal electors279,773[1]ReservationNoneMember of Legislative Assembly15th Gujarat Legislative AssemblyIncumbent C.K Raulji PartyBharatiya Janata PartyElected year2022 Godhra is one of the 182 Legislative Assembly constituencies of Gujarat state in India.[2][...

 

Буквы со сходным начертанием: Ң · ң · Ⱨ Буква кириллицы Н с хвостиком Ӊӊ Изображение ◄ Ӆ ӆ Ӈ ӈ Ӊ ӊ Ӌ ӌ Ӎ ► ◄ ӆ Ӈ ӈ Ӊ ӊ Ӌ ӌ Ӎ ӎ ► Характеристики Название Ӊ: cyrillic capital letter en with tailӊ: cyrillic small letter en with tail Юникод Ӊ: U+04C9ӊ: U+04CA HTML-код Ӊ‎:...

 

Reality television singing competition The Voice NigeriaGenreRealityTalent ShowCreated byJohn de MolBased onThe Voice of HollandPresented byIK Osakioduwa(1-2)Stephanie Coker(1-3)Toke Makinwa(3-)Nancy Isime(3-)JudgesWaje(1-)Yemi Alade(2-3)2Baba(1)Patoranking(1-2)Timi Dakolo(1-2)Darey(3)Falz(3)Naeto C(4-)Niyola(4-) Praiz(4-)Theme music composerMartijn SchimmerOpening themeThis is The VoiceEnding themeThis is The VoiceCountry of originNigeriaOriginal languageEnglishNo. of seasons4No. of episodes...

 

Primer número de Amazing Stories, de abril de 1926. La portada es de Frank R. Paul. Las revistas de ciencia ficción y fantasía comenzaron a publicarse en Estados Unidos en la década de 1920. Historias con temas de ciencia ficción ya habían aparecido durante décadas en revistas pulp como Argosy, pero no se publicaron revistas especializadas en un único género hasta 1915, cuando Street & Smith, uno de los principales editores de publicaciones pulp, lanzó la revista Detective Story...

 

机器学习与数据挖掘 范式 监督学习 無監督學習 線上機器學習 元学习(英语:Meta-learning (computer science)) 半监督学习 自监督学习 强化学习 基于规则的机器学习(英语:Rule-based machine learning) 量子機器學習 问题 统计分类 生成模型 迴歸分析 聚类分析 降维 密度估计(英语:density estimation) 异常检测 数据清洗 自动机器学习 关联规则学习 語意分析 结构预测(英语:Structured...

 

Murad Iمراد اولHüdavendigârSultan Utsmaniyah Ke-3BerkuasaMaret 1362 – 14 Juni 1389PendahuluOrhanPenerusBayezid IInformasi pribadiKelahiran29 Juni 1326Amasya,[1] Turki modernKematian15 Juni 1389(1389-06-15) (umur 62)KosovoPemakamandimakamkan di Tomb of Sultan Murad, Kosovo Field, in present-day Prishtina District, Kosovo[a]42°42′07″N 21°06′15″E / 42.70194°N 21.10417°E / 42.70194; 21.10417Koordinat: 42°42′07″N 21°06′15�...

 

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (يوليو 2021) كتاب القانونکتاب قانونمعلومات عامةالصنف الفني كوميديا رومانسية تاريخ الصدور 2009 مدة العرض 95 دقيقة[1] اللغة الأصلية الفارسية — الفرنسية البلد إيران مواق�...

 

For other uses, see Chevrolet Blazer (disambiguation). This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Chevrolet S-10 Blazer – news · newspapers · books · scholar · JSTOR (July 2008) (Learn how and when to remove this template message) Motor vehicle Chevrolet (S-10) Blazer / GMC (S-15) JimmyOverviewManufactu...