[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: My report on experiments with unused namespaces
On Tue, 21 Sep 2010 16:25:46 -0400, Costello, Roger L. wrote: > I wish to verify that I correctly understand Amelia's post. Errrrrrr. > --------------------------------------------------------- > <Root xmlns:soap="http://www.w3.org/2001/09/soap-envelope"> > > <faultcode>soap:Client</faultcode> > > </Root> > --------------------------------------------------------- > > Notice the value of <faultcode> is a QName. > > If the application that receives the XML document is _not_ "SOAP > aware" then the application _may_ treat soap:Client as simply data, > not as a QName. That application _may_ consider this to be an unused > namespace: > > http://www.w3.org/2001/09/soap-envelope > > If the application that receives the XML document _is_ "SOAP aware" > then the application _must_ process soap:Client as a QName. Thus, If that's an RFC 2119 "MUST", then a random "soap-aware" application (whatever that may be) MUST follow the specification for SOAP-aware applications. Since this isn't a SOAP message, I have no idea where your "MUST" comes from. > that application _must_ consider this to be a used namespace: > > http://www.w3.org/2001/09/soap-envelope > > Is this correct? To the best of my knowledge and belief, there is no specification or schema governing the message supplied above, so processors are free to do whatever they would like to do with it. > <soap:Envelope xmlns:soap="http://www.w3.org/2001/09/soap-envelope"> > > ... > > <soap:Envelope> Ah, now, we have a specification that discusses the contents of SOAP messages. > Notice that the element name is a QName. > > According to the XML REC, element names may contain colons. Thus, > soap:Envelope could simply be the name of the element. However, the > REC also says this: > > Note: > > The Namespaces in XML Recommendation [XML Names] > assigns a meaning to names containing colon characters. > Therefore, authors should not use the colon in XML names > except for namespace purposes, but XML processors must > accept the colon as a name character. > > I conclude from that note that all XML-aware applications which > receive the above XML document _must_ treat soap:Envelope as a QName. Good heavens. How silly. All of those pre-namespace XML implementations are thus condemned as not-XML, just because they predate the concept of QName? > Therefore all applications (SOAP-aware applications and SOAP-unaware > applications) _must_ consider this namespace as being used: > > http://www.w3.org/2001/09/soap-envelope What does: "this namespace is in use" and "this namespace is not in use" mean? There are several different ways to answer each of those questions (although answering one "true" should *generally* mean that the other is answered "false"). Is "in use" defined by the Namespaces in XML specification? Before the concept can be useful, it must be meaningful. On the other hand, because there are dragons here, it behooves one to have a use in mind before taking the time to map this territory. Why does it *matter* whether you label a namespace "in use" or "not in use"? What are you trying to achieve? The Namespaces in XML specification *does* define what it means to declare a namespace to prefix mapping. It is easy to say "this namespace is mapped to this prefix in this element scope." It is at least possible to say "if this namespace declaration were removed (and no other change were made), this document would no longer be well-formed." That seems to correspond to your "in use as part of element name" scenario (and also corresponds to the similar, though not identical, "in use as part of attribute name" scenario--there's an interesting distinction there, since it's guaranteed that xmlns="" can only affect element well-formedness, whereas xmlns:[x]="" can affect attributes as well). Now, for the case where a QName is used in element or attribute content, but not as part of element or attribute names, suppression of the controlling namespace declaration can produce invalid XML, but not ill-formed XML. That's an important distinction, because validation errors are not required to be fatal. Make a document ill-formed (including the special case "namespace-ill-formed"), and the parser is *required* to produce a fatal error and *stop parsing*. Now, there's an interesting parallel to the above distinction between namespace declarations that can only affect elements, and never attributes: those declarations (declarations of the mapping to the default/nil prefix) can never be used in element and attribute content, either (well ... in fact, they could, potentially, but no specification that uses QNames in content permits that, so far as I am aware). Given these potentially significant characterizations, what's the goal of categorizing namespace declarations as "in use" or "not in use"? Amy! -- Amelia A. Lewis amyzing {at} talsever.com Being your slave, what should I do but tend upon the hours and times of your desire? I have no precious time at all to spend, nor services to do, till you require.
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|