Xerces should be adding prefix for defaulted/fixed attibutes in a namespace
from XMLSchema validation.
------------------------------------------------------------------------------------------------------
Key: XERCESJ-1524
URL: https://issues.apache.org/jira/browse/XERCESJ-1524
Project: Xerces2-J
Issue Type: Bug
Components: XML Schema 1.1 Structures
Affects Versions: 2.11.0
Environment: All
Reporter: Rolf
This issue has appeared in various forms before. See
https://issues.apache.org/jira/browse/XERCESJ-455 and
https://issues.apache.org/jira/browse/XERCESJ-1474
At its simplest, the issue is that, when you have an XMLSchema that declares an
attribute to be form="qualified" and either fixed="some-val" or
default="some-val" then the Xerces SAX (and DOM) parsers do not include
namespace prefix data to the DOM hierarchy, or ContentHandler.startElement()
call. For example, with the XSD (./MySchema.xsd):
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="myns"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="myns"
elementFormDefault="qualified">
<xs:element name="doc">
<xs:complexType>
<xs:attribute name="att" default="defval" form="qualified"/>
</xs:complexType>
</xs:element>
</xs:schema>
A simple document is:
<doc xmlns="myns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="myns ./MySchema.xsd">
We define the root element 'doc' should have an attribute 'att' with the
default value 'defval'. This 'att' attribute should be in the namespace 'myns'.
When startElement() is called on the ContentHandler, the current 2.11 Xerces
parser sets the Attribute details for the 'att' attribute as:
LocalName -> 'att'
QName -> 'att'
URI -> 'myns'
Value -> 'defval'
The issue is that the QName for this attribute has no namespace prefix.
This issue has been previously discussed, but, the previous discussions are now
out of date, and the XMLSchema specification has now included this particular
situation. The current xerces parser is no longer conforming with XSD 1.1.
The particular references in XSD 1.1 are:
http://www.w3.org/TR/xmlschema11-1/#sec-ctdsic <-- This section indicates
that 'namespace fixup' should be performed, and it indicates that [prefix] is
part of the infoset. Further, namespacefixup is defined here:
http://www.w3.org/TR/xmlschema11-1/#term-ns-fixup
Together, these indicate that the validating parser should use an existing
'prefixed' namespace declaration's prefix for the defautled/fixed attribute,
or, in the absense of a prefixed namespace, it should create a 'impelentation
dependant' prefix for the namespace.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]