[dna-issues] [JBoss JIRA] Commented: (DNA-223) XML sequencer does not properly handle namespaces of unqualified attributes
Randall Hauch (JIRA)
jira-events at lists.jboss.org
Thu Sep 11 20:29:20 EDT 2008
[ https://jira.jboss.org/jira/browse/DNA-223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12429233#action_12429233 ]
Randall Hauch commented on DNA-223:
-----------------------------------
Okay, this isn't quite so straightforward. This appears to be the basic mechanism, but XML Schema allows for the 'attributeFormDefault' setting to control whether an XML element's attributes should or should not inherit the namespace. By default, the 'attributeFormDefault' is set to 'unqualified', meaning the attributes should not be qualified with a prefix. This is pretty unfortunately, because that means we'd have to not only discover this for an XML document, but we'd have to then read in the XML schema document.
Unfortunately, I don't think there's an approach that will always work. Damned if we do, and damned if we don't.
> 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: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the dna-issues
mailing list