]
Johnny Verhaeg updated DNA-223:
-------------------------------
Comment: was deleted
XML sequencer does not properly handle namespaces of unqualified
attributes
---------------------------------------------------------------------------
Key: DNA-223
URL:
https://jira.jboss.org/jira/browse/DNA-223
Project: DNA
Issue Type: Bug
Components: Sequencers
Affects Versions: 0.2
Reporter: Randall Hauch
Assignee: Randall Hauch
Fix For: 0.2
I've been looking at the XML sequencer behavior, and I was a little surprised to find
out that it treats unqualified attributes (i.e., those without a namespace prefix) as
inheriting the namespace of the parent element. For example, this XML document:
<dna:system
xmlns:dna="http://www.jboss.org/dna"
xmlns:jcr="http://www.jcp.org/jcr/1.0">
<!-- Define the sources from which content is made available -->
<dna:sources>
<sourceA name="Cars"
dna:classname="org.jboss.dna.connector.inmemory.InMemoryRepositorySource"
retryLimit="3" />
<sourceB name="Aircraft"
dna:classname="org.jboss.dna.connector.inmemory.InMemoryRepositorySource" />
</dna:sources>
</dna:system>
is imported so that the "retryLimit" attribute is turned into a
"dna:retryLimit" property. That property, however, should use the default
namespace.
I'm not sure whether this was intended, but I don't believe this behavior is
correct. Yes, unqualified child elements do inherit the namespace of their parent, but
attributes do not. According to the spec (
http://www.w3.org/TR/xml-names/#defaulting),
emphasis mine:
"The scope of a default namespace declaration extends from the beginning of the
start-tag in which it appears to the end of the corresponding end-tag, excluding the scope
of any inner default namespace declarations. In the case of an empty tag, the scope is the
tag itself.
"A default namespace declaration applies to all unprefixed element names within
its scope. Default namespace declarations do not apply directly to attribute names; the
interpretation of unprefixed attributes is determined by the element on which they
appear.
"If there is a default namespace declaration in scope, the expanded name
corresponding to an unprefixed element name has the URI of the default namespace as its
namespace name. If there is no default namespace declaration in scope, the namespace name
has no value. The namespace name for an unprefixed attribute name always has no value. In
all cases, the local name is local part (which is of course the same as the unprefixed
name itself)."
Unfortunately, none of the examples in the spec seem to show the behavior for attributes.
But here are a few links that seem to agree with my interpretation:
http://www.twoscomplement.com/2008/03/16/xml-attribute-namespaces/
http://annevankesteren.nl/2005/03/null-namespace
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: