[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] XML processor behavior with unused NS declarations
- From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
- To: xml-dev@lists.xml.org
- Date: Tue, 14 Jul 2009 12:58:06 -0400
At 2009-07-14 11:38 -0500, Chuck Bearden wrote:
>Is a namespace-aware XML processor permitted to drop a namespace
>declaration when no elements or attributes in that namespace are
>used within the scope of the declaration? Say, given this example
>from the RDRa Primer:
>
> <div xmlns:dc="http://purl.org/dc/elements/1.1/">
> <h2 property="dc:title">The trouble with Bob</h2>
> <h3 property="dc:creator">Alice</h3>
> ...
> </div>
>
>there's no danger of the processor dropping the 'xmlns:dc'
>declaration, correct?
>
>I looked at the Namespaces in XML recommendation, and it doesn't
>mention omitting them. A namespace-unaware processor would treat NS
>declarations like attributes and hence not drop them, so I reckon
>that a NS-aware processor should match that behavior as well, but
>confirmation from the cognoscenti is welcome!
In your example, they are not benign ... in my XSLT processing of the
attributes I may have a need for de-referencing the prefix I discover
in the attribute value. I would use the namespace axis in order to
find the URI associated with the prefix. Without it, how would I
know that "dc:title" is the Dublin Core title? I doubt I could rely
on solely the prefix.
And also the XPath data model needs that information in order to
support in-scope-prefixes() and other library functions that supply
namespace information.
Although I cannot find chapter and verse in the namespaces
specification, I think you are not permitted to drop the namespace
declaration in an XML processor that will be used for data models
such as the XDM. How would you know the context in which your XML
processor is being used? I suppose if you choose not to keep the
declaration around then you would have to advertise that fact so that
users of the processor understand the limitations. But I think you
just have to keep them around.
I hope this helps.
. . . . . . . . . . . . Ken
--
XQuery/XSLT/XSL-FO hands-on training - Oakland, CA, USA 2009-08-03
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video
Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18
Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers: http://www.CraneSoftwrights.com/legal
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]