Domain: iana.org
Stories and comments across the archive that link to iana.org.
Stories · 16
-
3D Freeciv-Web (Beta) Released (freeciv.org)
It's the open source web version of the classic Linux strategy game, and now Slashdot reader Andreas(R) -- one of its developers -- has an announcement. Now the developers are working on bringing the game to the modern era with 3D WebGL graphics [and] a beta of the 3D WebGL version of Freeciv has been released today. The game will work on any device with a browser with HTML5 and WebGL support, and three gigabytes of RAM... It's a volunteer community development project and anyone is welcome to contribute to the project. Have fun and remember to sleep!
The developers of Freeciv-web are now also working on a VR version using Google Cardboard, according to the site, while the original Freeciv itself has still been maintained for over 20 years -- and apparently even has its own dedicated port number. -
Freeciv Founded 20 Years Ago Today (freeciv.org)
Andreas(R) writes to note that the Freeciv project today turns 20. The GPL'd project "was founded on November 14 1995, by Peter Joachim Unold, Claus Leth Gregersen and Allan Ove Kjeldbjerg. The three Danish students created this open source strategy game while studying computer science at Aarhus University. Today, 20 years later the founders of the project have been interviewed to find out about the early history of Freeciv."
Not that many games have their own officially designated port numbers, which says something about Freeciv's tenacity. -
.Onion Gets a Boost From IETF, IANA: Now It's a Special-Use Domain
An anonymous reader writes: As tweeted by Jacob Appelbaum, the Internet Assigned Numbers Authority today listed .onion as a special-use domain, and the IETF approved a Draft RFC for the domain describing its intended uses. As described on the Facebook Over Tor page, "Jointly, these actions enable '.onion' as special-use, top-level domain name for which SSL certificates may be issued in accordance with the Certificate-Authority & Browser Forum 'Ballot 144' — which was passed in February this year. ... Together, this assures the validity and future availability of SSL certificates in order to assert and protect the ownership of Onion sites throughout the whole of the Tor network." -
Last Available IPv4 Blocks Allocated
stoborrobots writes "Following on from APNIC's earlier assessment that they would need to request the last available /8 blocks, they have now been allocated 39/8 and 106/8, triggering ARIN's final distribution of blocks to the RIRs. According to the release, 'APNIC expects normal allocations to continue for a further three to six months.'" -
Example.com Has Changed
An anonymous reader writes "The familiar example.com domain, reserved for private testing, has been updated. Visiting the domain in a web browser no longer displays any content; instead, visitors are redirected to an explanatory page on IANA's website at iana.org/domains/example/. Other example domains such as example.net are also affected. Is this a bad change? Will the redirect cause problems for anybody?" -
Example.com Has Changed
An anonymous reader writes "The familiar example.com domain, reserved for private testing, has been updated. Visiting the domain in a web browser no longer displays any content; instead, visitors are redirected to an explanatory page on IANA's website at iana.org/domains/example/. Other example domains such as example.net are also affected. Is this a bad change? Will the redirect cause problems for anybody?" -
Free IPv4 Pool Now Down To Seven /8s
Zocalo writes "For those of you keeping score, ICANN just allocated another four /8 IPv4 blocks; 23/8 and 100/8 to ARIN, 5/8 and 37/8 to RIPE, leaving just seven /8s unassigned. In effect however, this means that there are now just two /8s available before the entire pool will be assigned due to an arrangement whereby the five Regional Internet Registries would each automatically receive one of the final five /8s once that threshold was met. The IPv4 Address Report counter at Potaroo.net is pending an update and still saying 96 days, but it's now starting to look doubtful that we're going to even make it to January." -
Educause Announces Plans To Sign .edu TLD With DNSSEC
jhutkd writes "Educause (who run the .edu gTLD) announced today that they will deploy DNSSEC and sign the .edu zone by the end of March 2010. This will enable all educational institutions to benefit from deploying DNSSEC via the secure delegation hierarchy starting with IANA's ITAR (a temporary surrogate for the root zone signing), going through .edu, down to schools, and potentially leading all the way down to individual departments. Unlike larger gTLDs like .org, the churn of adding new and deleting old zones in .edu is much lower (due to the fact that there are tight controls on who may register for a delegation). Thus, many of the hassles of adding new DS records and maintenance procedures might be more manageable and help speed DNSSEC's rollout in this branch of the DNS hierarchy." -
SCO Chair's Anti-Porn Act Advances In Utah
iptables -A FORWARD writes "Gov. Jon Huntsman Jr. of Utah reportedly plans to sign a resolution urging Congress to enact the Internet Community Ports Act. The ICPA proposes that online content be divided by port, rather like TVs have channels with adult and family content, so that certain internet ports will be 'clean' — so-called Community Ports — and others will be 'dirty.' Thus, they hope to remove objectionable content from port 80 and require that it be moved elsewhere (port 666 was already taken by Doom, sorry), so that people could more easily block objectionable content, or have their ISPs do the blocking for them. This concept is being pushed by the CP80 group, which is chaired by Ralph Yarro, who also chairs the SCO Group. That probably explains why they didn't choose to adopt RFC 3514, instead." -
Restricted Financial Support for Open-Source?
Anonymous Writer asks: "PayPal has become the standard for making donations to Open-Source projects, and in many cases the only way. Out of the 247 countries and territories represented by top-level domains on the Internet, credit cards are available in 128. However, PayPal only accepts credit cards from 45 of these countries, which excludes 83 from using their service. Nearly two-thirds of the countries on the Internet with valid credit card billing services are currently prevented from making donations using PayPal. Even credit cards issued from those 45 accepted countries with billing addresses not among them are excluded, which affects people working overseas and expatriots. If you want to support the Open-Source Software movement but don't live in a PayPal-accepted country, what are your alternatives?" -
DoC to Extend ICANN's Control of IANA
Luminous Coward writes "I first saw this on The Register. Kevin Murphy of Computerwire reports: The US Department of Commerce last week quietly published a document detailing its decision to "sole-source" the contract for the so-called IANA (Internet Assigned Numbers Authority) function to ICANN, as opposed to opening the contract for competitive bidding. ICANNWatch explains why this is a bad idea. They also report that the ccTLDs and the Internet Multicasting Service have expressed interest in running IANA." -
Tiny ccTLDs - Who Should You Register With?
mumkin asks: "I have been shopping for a new domain and am considering going with a more obscure ccTLD for my namespace needs. I like the thought of my lan being a virtual extension of a tropical isle or wind-swept steppe, and generally looking weird in people's logs :) Ideally the NIC would lack a full-on whois server, for that extra degree of anonymity. It is important to me that the registry be doing something worthwhile for the country whose TLD it's hawking, and not just ripping them off. Oh, and I want nothing to do with VeriSign, so .TV and .CC are right out (sorry, Tuvalu! sorry, Cocos Islands). So, the question is: what tiny ccTLD registrars allow non-resident registration, are trustworthy, inexpensive, preferably privacy-conscious, and give something truly meaningful back to the countries whose domains they sell? Here's what I have so far -- who else should I be looking at, or what have I got wrong?" Read on for mumkin's ccTLD listing..AS : American Samoa. American Territory. Pop ~68,000. The registry is based in New York City and makes no mention its relationship to American Samoa, or what if any benefits accrue to the people of AS in exchange for the sale of their TLD space. Cost: $45/year. Whois: limited.
.CX : Christmas Island. Home of the dreaded goatse. Part of the Indian Ocean Territories of Australia, pop ~ 3,000. Recently shafted by the bankruptcy of Planet Three, nic.cx is now (according to its website) "a community owned Christmas Island non profit company." $9.60 of every reg. fee goes to the "Christmas Island Information Economy Development Trust," underwriting the cost of internet service on the island. Service which is currently really limited (2 hours/day of dial-up for $25/mo). Cost: $37.40/year. Whois: yes
.HM : The Heard and McDonald Islands. Australian External Territory, Pop: 0. An antarctic island group, mostly covered in glaciers, generally off-limits to visitors. A UN world heritage site. The nic is managed by an Australian guy, and the reg fee pays for the costs of running the registry. All [surname].hm addresses are unavailable, as those have been sold to the mysterious www.my.hm email service. Probably the most morally neutral ccTLD to grab a domain in, since there are no residents to disenfranchise. Cost: $35/year. Whois: none
.PN : Pitcairn Island. British Overseas Territory. Home of 44 descendants of the Bounty mutineers (half of whom are currently under investigation for more recent unsavory acts). Supposedly the sale of domains will help to bring internet access to the island, (they currently have limited, $3.50/min satellite connection, courtesy of a seismic monitoring station on the island. Cost for a domain: auction. Whois: broken
.PS : Palestinian Territories. With only 50 domains registered, the .ps namespace is wide open. It's the only NIC I can think of that's likely to be bombed/raided/otherwise reduced by a military force, since it's located in beautiful Ramallah. Given the US Govt's current mindset, owning a .ps domain could also make you a Person of Interest to any number of three-letter agencies. Cost: $45/year. Whois: limited
.SH : St. Helena Island and .AC : Ascension Island. British Overseas Territories with a population of ~6,000 and ~1,000 respectively. Jamestown, St Helena is the capitol from which the islands of St Helena, Ascension, and Tristan da Cunha are governed. The NIC is run out of London and provides free name service and registration for anyone with residency. Ascension is an an incredibly well-networked island for its size. Cost: $100 first year, $50/year thereafter. Whois: yes
.TJ : Tajikistan. Central Asian nation, pop ~6,250,000. NIC is run by two guys in Fresno who also run one of the two Public Registrars for Tajikistan. No information about their relationship to Tajikistan, or what if any benefits the country may receive from their registry fees. Site last updated in '98. Cost: $25/year ($8/year within .com.tj, .web.tj, etc) Whois: yes
.TP : East Timor. Big news a while back, the media seems to have forgotten about them once the shooting stopped. Their TLD is managed by Connect-Ireland as a public service to the Timorese diaspora. There is little documentation on the site, and it's unclear where the $35/year registration fee goes. Xanana Gusmao, former resistance leader and current president, is the Administrative Contact! Note: on May 20th, the ISO 3166 list changed East Timor's alpha-2 designation to TL (Timor Leste). Presumably the IANA will soon change their TLD accordingly. Cost: $35/year. Whois: none" -
Tiny ccTLDs - Who Should You Register With?
mumkin asks: "I have been shopping for a new domain and am considering going with a more obscure ccTLD for my namespace needs. I like the thought of my lan being a virtual extension of a tropical isle or wind-swept steppe, and generally looking weird in people's logs :) Ideally the NIC would lack a full-on whois server, for that extra degree of anonymity. It is important to me that the registry be doing something worthwhile for the country whose TLD it's hawking, and not just ripping them off. Oh, and I want nothing to do with VeriSign, so .TV and .CC are right out (sorry, Tuvalu! sorry, Cocos Islands). So, the question is: what tiny ccTLD registrars allow non-resident registration, are trustworthy, inexpensive, preferably privacy-conscious, and give something truly meaningful back to the countries whose domains they sell? Here's what I have so far -- who else should I be looking at, or what have I got wrong?" Read on for mumkin's ccTLD listing..AS : American Samoa. American Territory. Pop ~68,000. The registry is based in New York City and makes no mention its relationship to American Samoa, or what if any benefits accrue to the people of AS in exchange for the sale of their TLD space. Cost: $45/year. Whois: limited.
.CX : Christmas Island. Home of the dreaded goatse. Part of the Indian Ocean Territories of Australia, pop ~ 3,000. Recently shafted by the bankruptcy of Planet Three, nic.cx is now (according to its website) "a community owned Christmas Island non profit company." $9.60 of every reg. fee goes to the "Christmas Island Information Economy Development Trust," underwriting the cost of internet service on the island. Service which is currently really limited (2 hours/day of dial-up for $25/mo). Cost: $37.40/year. Whois: yes
.HM : The Heard and McDonald Islands. Australian External Territory, Pop: 0. An antarctic island group, mostly covered in glaciers, generally off-limits to visitors. A UN world heritage site. The nic is managed by an Australian guy, and the reg fee pays for the costs of running the registry. All [surname].hm addresses are unavailable, as those have been sold to the mysterious www.my.hm email service. Probably the most morally neutral ccTLD to grab a domain in, since there are no residents to disenfranchise. Cost: $35/year. Whois: none
.PN : Pitcairn Island. British Overseas Territory. Home of 44 descendants of the Bounty mutineers (half of whom are currently under investigation for more recent unsavory acts). Supposedly the sale of domains will help to bring internet access to the island, (they currently have limited, $3.50/min satellite connection, courtesy of a seismic monitoring station on the island. Cost for a domain: auction. Whois: broken
.PS : Palestinian Territories. With only 50 domains registered, the .ps namespace is wide open. It's the only NIC I can think of that's likely to be bombed/raided/otherwise reduced by a military force, since it's located in beautiful Ramallah. Given the US Govt's current mindset, owning a .ps domain could also make you a Person of Interest to any number of three-letter agencies. Cost: $45/year. Whois: limited
.SH : St. Helena Island and .AC : Ascension Island. British Overseas Territories with a population of ~6,000 and ~1,000 respectively. Jamestown, St Helena is the capitol from which the islands of St Helena, Ascension, and Tristan da Cunha are governed. The NIC is run out of London and provides free name service and registration for anyone with residency. Ascension is an an incredibly well-networked island for its size. Cost: $100 first year, $50/year thereafter. Whois: yes
.TJ : Tajikistan. Central Asian nation, pop ~6,250,000. NIC is run by two guys in Fresno who also run one of the two Public Registrars for Tajikistan. No information about their relationship to Tajikistan, or what if any benefits the country may receive from their registry fees. Site last updated in '98. Cost: $25/year ($8/year within .com.tj, .web.tj, etc) Whois: yes
.TP : East Timor. Big news a while back, the media seems to have forgotten about them once the shooting stopped. Their TLD is managed by Connect-Ireland as a public service to the Timorese diaspora. There is little documentation on the site, and it's unclear where the $35/year registration fee goes. Xanana Gusmao, former resistance leader and current president, is the Administrative Contact! Note: on May 20th, the ISO 3166 list changed East Timor's alpha-2 designation to TL (Timor Leste). Presumably the IANA will soon change their TLD accordingly. Cost: $35/year. Whois: none" -
South Africa Wants Control of .za
fdiaz5583 writes "Recently, the South African government wants to seize control of the .za domain. However, ICANN owns the domains and under the ICANN rules, they will not relinquish control. Mike Lawrie who is global administrator of domain names states: 'If it becomes illegal for me to do the job under South African law and if I am not authorized by ICANN to hand over the administration, the .za domain will have to shut down until the issue is cleared up'." We mentioned this tussle earlier. The .za administrator doesn't like the way the government is going about this; the government, of course, has men with guns, so it's not like he's going to win in the end, it's only a question of how ugly it will get. -
XML Namespaces and How They Affect XPath and XSLT
Dare Obasanjo writes: "XML namespaces are an integral aspect of most of the W3C's XML recommendations and working drafts, including XPath, XML Schema, XSLT, XQuery, SOAP, RDF, DOM, and XHTML. Understanding how namespaces work and how they interact with a number of other W3C technologies that are dependent on them is important for anyone working with XML to any significant degree." Some heavy reading below, as Dare completes the thought.This article explores the ins and outs of XML namespaces and their ramifications on a number of XML technologies that support namespaces. What follows is a shortened version of my first Extreme XML column.
Overview of XML NamespacesAs XML usage on the Internet became more widespread, the benefits of being able to create markup vocabularies that could be combined and reused similarly to how software modules are combined and reused became increasingly important. If a well defined markup vocabulary for describing coin collections, program configuration files, or fast food restaurant menus already existed, then reusing it made more sense than designing one from scratch. Combining multiple existing vocabularies to create new vocabularies whose whole was greater than the sum of its parts also became a feature that users of XML began to require.
However, the likelihood of identical markup, specifically XML elements and attributes, from different vocabularies with different semantics ending up in the same document became a problem. The very extensibility of XML and the fact that its usage had already become widespread across the Internet precluded simply specifying reserved elements or attribute names as the solution to this problem.
The goal of the W3C XML namespaces recommendation was to create a mechanism in which elements and attributes within an XML document that were from different markup vocabularies could be unambiguously identified and combined without processing problems ensuing. The XML namespaces recommendation provided a method for partitioning various items within an XML document based on processing requirements without placing undue restrictions on how these items should be named. For instance, elements named
<template>,<output>, and<stylesheet>can occur in an XSLT stylesheet without there being ambiguity as to whether they are transformation directives or potential output of the transformation.An XML namespace is a collection of names, identified by a Uniform Resource Identifier (URI) reference, which are used in XML documents as element and attribute names.
Namespace DeclarationsA namespace declaration is typically used to map a namespace URI to a specific prefix. The scope of the prefix-namespace mapping is that of the element that the namespace declaration occurs on as well as all its children. An attribute declaration that begins with the prefix
xmlns:is a namespace declaration. The value of such an attribute declaration should be a namespace URI which is the namespace name.Here is an example of an XML document where the root element contains a namespace declaration that maps the prefix
<bk:bookstore xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">bkto the namespace nameurn:xmlns:25hoursaday-com:bookstoreand its child element contains aninventoryelement that contains a namespace declaration that maps the prefixinvto the namespace nameurn:xmlns:25hoursaday-com:inventory-tracking.
<bk:book>
<bk:title>Lord of the Rings</bk:title>
<bk:author>J.R.R. Tolkien</bk:author>
<inv:inventory status="in-stock" isbn="0345340426"
xmlns:inv="urn:xmlns:25hoursaday-com:inventory-tracking" />
</bk:book>
</bk:bookstore>
In the above example, the scope of the namespace declaration for the
urn:xmlns:25hoursaday-com:bookstorenamespace name is the entirebk:bookstoreelement, while that of theurn:xmlns:25hoursaday-com:inventory-trackingis theinv:inventoryelement. Namespace aware processors can process items from both namespaces independently of each other, which leads to the ability to do multi-layered processing of XML documents. For instance, RDDL documents are valid XHTML documents that can be rendered by a Web browser but also contain information using elements from thehttp://www.rddl.orgnamespace that can be used to locate machine readable resources about the members of an XML namespace.It should be noted that by definition the prefix
Default Namespacesxmlis bound to the XML namespace name and this special namespace is automatically predeclared with document scope in every well-formed XML document.The previous section on namespace declarations is not entirely complete because it leaves out default namespaces. A default namespace declaration is an attribute declaration that has the name
xmlnsand its value is the namespace URI that is the namespace name.A default namespace declaration specifies that every unprefixed element name in its scope be from the declaring namespace. Below is the bookstore example utilizing a default namespace instead of a prefix-namespace mapping.
<bookstore xmlns="urn:xmlns:25hoursaday-com:bookstore">
<book>
<title>Lord of the Rings</bk:title>
<author>J.R.R. Tolkien</bk:author>
<inv:inventory status="in-stock" isbn="0345340426"
xmlns:inv="urn:xmlns:25hoursaday-com:inventory-tracking" />
</book>
</bookstore>
All the elements in the above example except for the
inv:inventoryelement belong to theurn:xmlns:25hoursaday-com:bookstorenamespace. The primary purpose of default namespaces is to reduce the verbosity of XML documents that utilize namespaces. However, using default namespaces instead of utilizing explicitly mapped prefixes for element names can be confusing because it is not obvious that the elements in the document are namespace scoped.Also, unlike regular namespace declarations, default namespace declarations can be undeclared by setting the value of the xmlns attribute to the empty string. Undeclaring default namespace declarations is a practice that should be avoided because it may lead to a document that has unprefixed names that belong to a namespace in one part of the document, but don't in another. For example, in the document below only the
<bookstore xmlns="urn:xmlns:25hoursaday-com:bookstore">bookstoreelement is from theurn:xmlns:25hoursaday-com:bookstorewhile the other unprefixed elements have no namespace name.
<book xmlns="">
<title>Lord of the Rings</bk:title>
<author>J.R.R. Tolkien</bk:author>
<inv:inventory status="in-stock" isbn="0345340426"
xmlns:inv="urn:xmlns:25hoursaday-com:inventory-tracking" />
</book>
</bookstore>
This practice should be avoided because it leads to extremely confusing situations for readers of the XML document. For more information on undeclaring namespace declarations, see the section on Namespaces Future.
Qualified and Expanded NamesA qualified name, also known as a QName, is an XML name called the local name optionally preceded by another XML name called the prefix and a colon (':') character. The XML names used as the prefix and the local name must match the NCName production, which means that they must not contain a colon character. The prefix of a qualified name must have been mapped to a namespace URI through an in-scope namespace declaration mapping the prefix to the namespace URI. A qualified name can be used as either an attribute or element name.
Although QNames are important mnemonic guides to determining what namespace the elements and attributes within a document are derived from, they are rarely important to XML aware processors. For example, the following three XML documents would be treated identically by a range of XML technologies including, of course, XML schema validators.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType id="123" name="fooType"/>
</xs:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType id="123" name="fooType"/>
</xsd:schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<complexType id="123" name="fooType"/>
</schema>
The W3C XML Path Language recommendation describes an expanded name as a pair consisting of a namespace name and a local name. A universal name is an alternate term coined by James Clark to describe the same concept. A universal name consists of a namespace name in curly braces and a local name. Namespaces tend to make more sense to people when viewed through the lens of universal names. Here are the three XML documents from the previous example with the QNames replaced by universal names. Note that the syntax below is not valid XML syntax.
<{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}complexType id="123" name="fooType"/>
</{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}complexType id="123" name="fooType"/>
</{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}schema>
<{http://www.w3.org/2001/XMLSchema}complexType id="123" name="fooType"/>
</{http://www.w3.org/2001/XMLSchema}schema>
To many XML applications, the universal name of the elements and attributes in an XML document are what is important, and not the values of the prefixes used in specific QNames. The primary reason the Namespaces in XML recommendation does not take the expanded name approach to specifying namespaces is due to its verbosity. Instead, prefix mappings and default namespaces are provided to save us all from developing carpal tunnel syndrome from typing namespace URIs endlessly.
Namespaces and AttributesNamespace declarations do not apply to attributes unless the attribute's name is prefixed. In the XML document shown below the
titleattribute belongs to thebk:bookelement and has no namespace while thebk:titleattribute hasurn:xmlns:25hoursaday-com:bookstoreas its namespace name. Note that even though both attributes have the same local name the document is well formed.<bk:bookstore xmlns:bk="urn:xmlns:25hoursaday-com:bookstore"></bk:bookstore>
<bk:book title="Lord of the Rings, Book 3" bk:title="Return of the King"/>
In the following example, the
titleattribute still has no namespace and belongs thebookelement even though there is a default namespace specified. In other words, attributes cannot inherit the default namespace.<bookstore xmlns="urn:xmlns:25hoursaday-com:bookstore"></bookstore>
<book title="Lord of the Rings, Book 3" />
Namespace URIsA namespace name is a Uniform Resource Identifier (URI) as specified in RFC 2396. A URI is either a Uniform Resource Locators (URLs) or a Uniform Resource Names (URNs). URLs are used to specify the location of resources on the Internet, while URNs are supposed to be persistent, location-independent identifiers for information resources. Namespace names are considered to be identical only if they are the same character for character (case-sensitive). The primary justification for using URIs as namespace names is that they already provide a mechanism for specifying globally unique identities.
The XML namespaces recommendation states that namespace names are only to act as unique identifiers and do not have to actually identify network retrievable resources. This has led to much confusion amongst authors and users of XML documents, especially since the usage of HTTP based URLs as namespace names has grown in popularity. Because many applications convert such URIs to hyperlinks, it is irritating to many users that these "links" do not lead to Web pages or other network retrievable resource. I remember one user who likened it to being given a fake phone number in a social situation.
One solution to avoid confusing users is to use a namespace-naming schema that does not imply network retrievability of the resource. I personally use the
urn:xmlns:scheme for this purpose and create namespace names similar tourn:xmlns:25hoursaday-comwhen authoring XML documents for personal use. The problem with homegrown namespace URIs is that they may run counter to the intent of the Names in XML recommendation by not being globally unique. I get around the globally unique requirement by using my personal domain name http://www.25hoursaday.com as part of the namespace URI.Another solution is to leave a network retrievable resource at the URI that is the namespace name, such as is done with the XSLT and RDDL namespaces. Typically, such URIs are actually HTTP URLs. A good way to name such URLs is by using the format favored by the W3C, which is as follows:
http://my.domain.example.org/product/[year/month][/area]
See the section on Namespaces and Versioning for more information on using similarly structured namespace names as a versioning mechanism.
DOM, XPath, and the XML Information Set on NamespacesThe W3C has defined a number of technologies that provide a data model for XML documents. These data models are generally in agreement, but sometimes differ in how they treat various edge cases due to historic reasons. Treatment of XML namespaces and namespace declarations is an example of an edge case that is treated differently in the three primary data models that exist as W3C recommendations. The three data models are the XPath data model, the Document Object Model (DOM), and the XML information set.
The XML information set (XML infoset) is an abstract description of the data in an XML document and can be considered to be the primary data model for an XML document. The XPath data model is a tree-based model that is traversed when querying an XML document and is similar to the XML information set. The DOM precedes both data models but is also similar to both data models in a number of ways. Both the DOM and the XPath data model can be considered to be interpretations of the XML infoset.
Namespaces in the Document Object Model (DOM)The XML namespace section of the DOM Level 3 specification considers namespace declarations to be regular attribute nodes that have http://www.w3.org/2000/xmlns/ as their namespace name and
xmlnsas their prefix or qualified name.Elements and attributes in the DOM have a namespace name that cannot be altered after they have been created regardless of whether their location within the document changes or not.
Namespaces in the XPath Data ModelThe W3C XPath recommendation does not consider namespace declarations to be attribute nodes and does not provide access to them in that capacity. Instead, in XPath every element in an XML document has a number of namespace nodes that can be retrieved using the XPath namespace navigation axis.
Each element in the document has a unique set of namespace nodes for each namespace declaration in scope for that particular element. Namespace nodes are unique to each element in that namespace. Thus namespace nodes for two different elements that represent the same namespace declaration are not identical.
Namespaces in the XML Information SetThe XML infoset recommendation considers namespace declarations to be attribute information items.
In addition, similar to the XPath data model, each element information item in an XML document's information set has a namespace information item for each namespace that is in scope for the element.
XPath, XSLT and NamespacesThe W3C XML Path Language also known as XPath is used to address parts of an XML document and is used in a number of W3C XML technologies including XSLT, XPointer, XML Schema, and DOM Level 3. XPath uses a hierarchical addressing mechanism similar to that used in file systems and URLs to retrieve pieces of an XML document. XPath supports rudimentary manipulation of strings, numbers, and Booleans.
XPath and NamespacesThe XPath data model treats an XML document as a tree of nodes, such as element, attribute, and text nodes, where the name of each node is a combination of its local name and its namespace name (that is, its universal or expanded name).
For element and attribute nodes without namespaces, performing XPath queries is fairly straightforward. The following program, which can be used to query XML documents using the command line, shall be used to demonstrate the impact of namespaces on XPath queries.
using System.Xml.XPath;
using System.Xml;
using System;
using System.IO;
class XPathQuery{
public static string PrintError(Exception e, string errStr){
if(e == null)
return errStr;
else
return PrintError(e.InnerException, errStr + e.Message );
}
public static void Main(string[] args){
if((args.Length == 0) || (args.Length % 2)!= 0){
Console.WriteLine("Usage: xpathquery source query <zero or more
prefix and namespace pairs>");
return;
}
try{
//Load the file.
XmlDocument doc = new XmlDocument();
doc.Load(args[0]);
//create prefix<->namespace mappings (if any)
XmlNamespaceManager nsMgr = new XmlNamespaceManager(doc.NameTable);
for(int i=2; i < args.Length; i+= 2)
nsMgr.AddNamespace(args[i], args[i + 1]);
//Query the document
XmlNodeList nodes = doc.SelectNodes(args[1], nsMgr);
//print output
foreach(XmlNode node in nodes)
Console.WriteLine(node.OuterXml + "\n\n");
}catch(XmlException xmle){
Console.WriteLine("ERROR: XML Parse error occured because " +
PrintError(xmle, null));
}catch(FileNotFoundException fnfe){
Console.WriteLine("ERROR: " + PrintError(fnfe, null));
}catch(XPathException xpath){
Console.WriteLine("ERROR: The following error occured while querying
the document: "
+ PrintError(xpath, null));
}catch(Exception e){
Console.WriteLine("UNEXPECTED ERROR" + PrintError(e, null));
}
}
}
Given the following XML document that does not declare any namespaces, queries are fairly straightforward as seen in the examples following the code.
<?xml version="1.0" encoding="utf-8" ?>
<bookstore>
<book genre="autobiography">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<book genre="novel">
<title>The Confidence Man</title>
<author>
<first-name>Herman</first-name>
<last-name>Melville</last-name>
</author>
<price>11.99</price>
</book>
</bookstore>
Example 1-
xpathquery.exe bookstore.xml /bookstore/book/titleSelects all the title elements that are children of the
bookelement whose parent is thebookstoreelement, which returns:
<title>The Autobiography of Benjamin Franklin</title>
<title>The Confidence Man</title> -
xpathquery.exe bookstore.xml //@genreSelect all the
genreattributes in the document and returns:
genre="autobiography"
genre="novel" -
xpathquery.exe bookstore.xml //title[(../author/first-name = 'Herman')]Selects all the titles where the author's first name is "Herman" and returns:
<title>The Confidence Man</title>
However, once namespaces are added to the mix, things are no longer as simple. The file below is identical to the original file except for the addition of namespaces and one attribute to one of the
<bookstore xmlns="urn:xmlns:25hoursaday-com:bookstore">bookelements.
<book genre="autobiography">
<title>The Autobiography of Benjamin Franklin</title>
<author>
<first-name>Benjamin</first-name>
<last-name>Franklin</last-name>
</author>
<price>8.99</price>
</book>
<bk:book genre="novel" bk:genre="fiction"
xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">
<bk:title>The Confidence Man</bk:title>
<bk:author>
<bk:first-name>Herman</bk:first-name>
<bk:last-name>Melville</bk:last-name>
</bk:author>
<bk:price>11.99</bk:price>
</bk:book>
</bookstore>
Note that the default namespace is in scope for the whole XML document, while the namespace declaration that maps the prefix
bkto the namespace nameurn:xmlns:25hoursaday-com:bookstoreis in scope for the second book element only.
-
xpathquery.exe bookstore.xml /bookstore/book/title
Selects all the title elements that are children of the
bookelement whose parent is thebookstoreelement, which returns NO RESULTS. -
xpathquery.exe bookstore.xml //@genreSelects all the
genreattributes in the document and returns:
genre="autobiography"
genre="novel" -
xpathquery.exe bookstore.xml //title[(../author/first-name = 'Herman')]Selects all the titles where the author's first name is "Herman," which returns NO RESULTS.
The first query returns no results because unprefixed names in an XPath query apply to elements or attributes with no namespace. There are no
bookstore,book, ortitleelements in the target document that have no namespace. The second query returns all attribute nodes that have no namespace. Although namespace declarations are in scope for both attribute nodes returned by the query, they have no namespace because namespace declarations do not apply to attributes with unprefixed names. The third query returns no results for the same reasons the first query returns no results.The way to perform namespace-aware XPath queries is to provide a prefix to namespace mapping to the XPath engine, then use those prefixes in the query. The prefixes provided do not need to be the same as the namespace to prefix mappings in the target document, and they must be non-empty prefixes.
-
xpathquery.exe bookstore.xml /b:bookstore/b:book/b:title b urn:xmlns:25hoursaday-com:bookstoreSelect all the title elements that are children of the
bookelement whose parent is thebookstoreelement and returns the following:
<title xmlns="urn:xmlns:25hoursaday-com:bookstore">The Autobiography of Benjamin Franklin</title>
<bk:title xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">The Confidence Man</bk:title> -
xpathquery.exe bookstore.xml //@b:genre b urn:xmlns:25hoursaday-com:bookstoreSelects all thegenreattributes from the "urn:xmlns:25hoursaday-com:bookstore" namespace in the document that returns:
bk:genre="fiction" -
xpathquery.exe bookstore.xml //bk:title[(../bk:author/bk:first-name = 'Herman')] bk urn:xmlns:25hoursaday-com:bookstore
Selects all the titles where the author's first name is "Herman" and returns:
<bk:title xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">The Confidence Man</bk:title>
Note This last example is the same as the previous examples but rewritten to be namespace aware.
For more information on using XPath, read Aaron Skonnard's article Addressing Infosets with XPath and view the examples at the ZVON.org XPath tutorial.
XSLT and NamespacesThe W3C XSL transformations (XSLT) recommendation describes an XML-based language for transforming XML documents into other XML documents. XSLT transformations, also known as XML style sheets, utilize patterns (XPath) to match aspects of the target document. Upon matching nodes in the target document, templates that specify the output of a successful match can be instantiated and used to transform the document.
Support for namespaces is tightly integrated into XSLT, especially since XPath is used for matching nodes in the source document. Using namespaces in your XPath expressions inside XSLT is much easier than using the DOM.
The example that follows contains:
- A program for use in executing transforms from the command line.
- An XSLT stylesheet that prints
all the
titleelements from theurn:xmlns:25hoursaday-com:bookstorenamespace in the source XML document when run against thebookstoredocument from theurn:xmlns:25hoursaday-com:bookstorenamespace. - The resulting output.
Imports System.Xml
Imports System
Imports System.IO
Class Transformer
Public Shared Function PrintError(e As Exception, errStr As String) As String
If e Is Nothing Then
Return errStr
Else
Return PrintError(e.InnerException, errStr + e.Message)
End If
End Function 'PrintError
'Entry point which delegates to C-style main Private Function
Public Overloads Shared Sub Main()
Run(System.Environment.GetCommandLineArgs())
End Sub 'Main
Overloads Public Shared Sub Run(args() As String)
If args.Length <> 2 Then
Console.WriteLine("Usage: xslt source stylesheet")
Return
End If
Try
'Create the XslTransform object.
Dim xslt As New XslTransform()
'Load the stylesheet.
xslt.Load(args(1))
'Transform the file.
Dim doc As New XmlDocument()
doc.Load(args(0))
xslt.Transform(doc, Nothing, Console.Out)
Catch xmle As XmlException
Console.WriteLine(("ERROR: XML Parse error occured because " +
PrintError(xmle, Nothing)))
Catch fnfe As FileNotFoundException
Console.WriteLine(("ERROR: " + PrintError(fnfe, Nothing)))
Catch xslte As XsltException
Console.WriteLine(("ERROR: The following error occured while
transforming the document: " + PrintError(xslte, Nothing)))
Catch e As Exception
Console.WriteLine(("UNEXPECTED ERROR" + PrintError(e, Nothing)))
End Try
End Sub
End Class 'Transformer
XSLT stylesheet <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:b="urn:xmlns:25hoursaday-com:bookstore">
<xsl:template match="b:bookstore">
<book-titles>
<xsl:apply-templates select="b:book/b:title"/>
</book-titles>
</xsl:template>
<xsl:template match="b:title">
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>
Output <?xml version="1.0" ?>
<book-titles xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:ext="urn:my_extensions" xmlns:b="urn:xmlns:25hoursaday-com:bookstore">
<title xmlns="urn:xmlns:25hoursaday-com:bookstore">The Autobiography of
Benjamin Franklin</title>
<bk:title xmlns="urn:xmlns:25hoursaday-com:bookstore"
xmlns:bk="urn:xmlns:25hoursaday-com:bookstore">The Confidence
Man</bk:title>
</book-titles>
Note that the namespace declarations from the stylesheet end up on the root node of the output XML document. Also to note is the fact that the XSLT namespace is not included in the output XML document.
Generating XSLT stylesheets from the output of your XSLT transforms is slightly cumbersome because the processor has to be able to determine the output elements from the actual stylesheet directives. There are two ways I have found to deal with this issue, both of which I'll illustrate by showing stylesheets that generate the following XMLT stylesheet as output.
<xslt:stylesheet version="1.0"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<xslt:output method="text"/>
<xslt:template match="/"><xslt:text>HELLO WORLD</xslt:text></xslt:template>
</xslt:stylesheet>
The first method involves creating a variable containing the stylesheet to be created, and then using
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">value-ofin combination with thedisable-output-escapingattribute to create the stylesheet.
<xsl:output method="xml" encoding="utf-8"/>
<xsl:variable name="stylesheet">
<xslt:stylesheet version="1.0"
xmlns:xslt="http://www.w3.org/1999/XSL/Transform">
<xslt:output method="text"/>
<xslt:template match="/"><xslt:text>HELLO
WORLD</xslt:text></xslt:template>
</xslt:stylesheet>
</xsl:variable>
<xsl:template match="/">
<xsl:value-of select="$stylesheet" disable-output-escaping="yes" />
</xsl:template>
</xsl:stylesheet>
This first method works best if the stylesheet being created can be easily partitioned so that it can be placed in variables. While this technique is quick and easy, it also falls into the category of gross hack, which typically tend to become unmanageable when faced with any situation requiring flexibility. For instance, when creation of the new stylesheet involves lots of dynamic creation of text and is intertwined with the stylesheet directives, the following method is preferable to the aforementioned gross hack.
<xslt:stylesheet version="1.0" xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
xmlns:alias="http://www.w3.org/1999/XSL/Transform-alias">
<xslt:output method="xml" encoding="utf-8"/>
<xslt:namespace-alias stylesheet-prefix="alias" result-prefix="xslt"/>
<xslt:template match="/">
<alias:stylesheet version="1.0">
<alias:output method="text"/>
<alias:template match="/"><alias:text>HELLO
WORLD</alias:text></alias:template>
</alias:stylesheet>
</xslt:template>
</xslt:stylesheet>
The above document uses the
namespace-aliasdirective to substitute thealiasprefix and namespace name it is bound to with thexsltprefix and the namespace name to which it is bound.Namespaces are also used to specify mechanisms for the extension of XSLT. Namespace prefixed functions can be created that are executed in the same manner as XSLT functions. Similarly, elements from certain namespaces can be treated as extensions to XSLT and executed as if they were transformation directives like
<stylesheet version="1.0"template,copy,value-of, and so on. Below is an example of a Hello World program that uses namespace-based extension functions to print the signature greeting.
xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:newfunc="urn:my-newfunc">
<output method="text"/>
<template match="/">
<value-of select="newfunc:SayHello()" />
</template>
<msxsl:script language="JavaScript" implements-prefix="newfunc">
function SayHello() {
return "Hello World";
}
</msxsl:script>
</stylesheet>
XML Namespace CaveatsNamespaces in XML, like any useful tool, can be used improperly and have various subtleties that may cause problems if users are unaware of them. This section focuses on areas where users of XML namespaces typically have problems or face misconceptions.
Versioning and NamespacesThere are two primary mechanisms used in practice to create different versions of an XML instance document. One method is to use a version attribute on the root element as is done in XSLT, while the other method is to use the namespace name of the elements as the versioning mechanism. Versioning based on namespaces is currently very popular, especially with the W3C, who have used this mechanism for various XML technologies including SOAP, XHTML, XML Schema, and RDF. The namespace URI for documents that are versioned using the namespace is typically in the following format:
http://my.domain.example.org/product/[year/month][/area]
The primary problem with versioning XML documents by altering the namespace name in subsequent versions is that it means XML namespace-aware applications that process the documents will no longer work with the documents, and will have to be upgraded. This is primarily beneficial with document formats whose versions change infrequently, but upon changing alter the semantics of elements and attributes, thus requiring that all processors no longer work with the newer versions for fear of misinterpreting them.
On the other hand, there are a number of scenarios where an XML document versioning mechanism based on a version attribute on the root element is sufficient. A version attribute is primarily beneficial when changes in the document's structure are backwards compatible. The following situations are all areas where using a version attribute is a wise choice:
- Semantics of elements and attributes will not be altered.
- Changes to the document involves the addition of elements and attributes, but rarely removal.
- Interoperability between applications with various versions of the processing software is necessary.
Both versioning techniques are not mutually exclusive and can be used simultaneously. For instance, XSLT uses both a version attribute on the root element, as well as a versioned namespace URI. The version attribute is used for incremental, backwards-compatible changes to the XML document's format, while altering the namespace name is done for significant changes in the semantics of the document.
Document TypesThe term document type is misleading as discussed in several philosophical debates on various XML related mailing lists . In many cases, the namespace name of the root element can be used to determine how to process the document, however, this is hardly a general rule and stating it as such violates the spirit of XML namespaces as they were designed exactly so that developers could mix and match XML vocabularies.
A succinct post that captures the essence of why thinking that root element namespace URI are equivalent to a notion of document type is this post by Rick Jelliffe on XML-DEV. The essence of the post is that there are many different types that an XML document could have, including its document type as specified by its Document Type Definition (DTD), its MIME media type, its schema definition as specified by the xsi:schemaLocation attribute, its file extension, as well as the namespace name of its root element. Thus it is quite likely that in many cases a document will have many different types depending on what perspective one decides to take when examining the document.
Two examples of XML documents in which actual document types can be misconstrued by simply looking at the namespace URI of the root element are RDDL documents (sample, notice that its root element is from the XHTML namespace) and annotated mapping schemas, which have their root element is from the W3C XML Schema namespace.
In a nutshell, the type of a document cannot conclusively be determined by looking at the namespace URI of its root element. Thinking otherwise is folly.
Namespaces FutureThere are a number of developments in the XML world focused on tackling some of the issues that have developed around XML namespaces. Firstly, the current draft of the W3C XML namespaces recommendation does not provide a mechanism for undeclaring namespaces that have been mapped to a prefix. The W3C XML namespaces v1.1 working draft is intended to rectify this oversight by providing a mechanism for undeclaring prefix namespace mappings in an instance document.
The debate on what should be returned on an attempt to dereference the contents of a namespace URI has lead to contentious debate in the XML world and is currently the focus of deliberations by the W3C's Technical Architecture Group. The current version of the XML namespaces recommendation does not require the namespace URI to actually be resolvable because a namespace URI is supposed to merely be a namespace name that is used as a unique identifier, and not the location of a resource on the Internet.
Tim Bray (one of the original editors of both the XML Language and XML namespaces recommendations) has written an exhaustive treatise on the issues around namespace URIs and the namespace documents that may or may not be retrieved from them. This document contains much of the reasoning that was behind his creation of the Resource Directory Description Language (RDDL), which is designed to be used for creating namespace documents.
-
-
Jon Postel dies
Over 30 of you wrote in to tell us that Jon Postel, died of complications after heart surgery at the age of 55. For those who don't know who Postel, he's the DNS admin (as head of the IANA), controlling the root name server setup and being a guiding force in the current government domain name wrangling. He was the voice of reason against many of the government's less-than-intelligent proposals for restructuring DNS. He was also editor of most of the 2500 RFCs. His PhD thesis adviser and his friend Vint Cerf sum up the feelings of the Internet community in this DejaNews post. The New York Times' obituary is here. You can also find an interview with Jon Postel from July. His homepage is simple and to the point.I'd like to thank Idcmp, Claude Johnson, and Jeff Garzik whose material was used to compile this report.