xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rolf (JIRA)" <xerces-j-...@xml.apache.org>
Subject [jira] [Created] (XERCESJ-1524) Xerces should be adding prefix for defaulted/fixed attibutes in a namespace from XMLSchema validation.
Date Mon, 15 Aug 2011 19:33:28 GMT
Xerces should be adding prefix for defaulted/fixed attibutes in a namespace from XMLSchema

                 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"
  <xs:element name="doc">
      <xs:attribute name="att" default="defval" form="qualified"/>

A simple document is:
<doc xmlns="myns"
               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:

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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org

View raw message