You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by sa...@ca.ibm.com on 2001/06/18 19:25:16 UTC

Re: [Bug 2216] New: - Namespaces for attributes of schema elements not processed

Hi all. I'm trying to fix this bug, but I need some clarification on
attributes from other namespaces.

The following segment is from "schema for schemas":

 <xs:complexType name="openAttrs">
   <xs:annotation>
     <xs:documentation>
       This type is extended by almost all schema types
       to allow attributes from other namespaces to be
       added to user schemas.
     </xs:documentation>
   </xs:annotation>
   <xs:complexContent>
     <xs:restriction base="xs:anyType">
       <xs:anyAttribute namespace="##other" processContents="lax"/>
     </xs:restriction>
   </xs:complexContent>
 </xs:complexType>

Three questions:

1. "This type is extended by almost all schema types to allow attributes
from other namespaces to be added to user schemas." How about attributes
from the schema namespace? For example:
   <xsd:element name="ele" type="xsd:string" xsd:use="invalid"/>
Is "xsd:use" considered to be the same as "use", or is it not allowed to
appear?

2. Does anyone know what are the exceptions of "almost all schema types"? I
went through all XML Representations of schema elements. It seems to me
that "{any attributes with non-schema namespace . . .}" doesn't appear in
"group", "appInfo", and "document", so I suspect that these 3 doesn't allow
attributes from other namespaces. Then I checked the schema for schemas,
but "group" seems to have two different types: groupRef and namedGroup,
where the first one extends "openAttrs" and the second one doesn't. Is this
an errata? I would think that "group" should also allow attributes from
other namespaces. (Otherwise, what makes it so different from others?)

3. Notice that processContents="lax", so it means we should validate those
attributes if we can find the declarations. Then where are we supposed to
find such declarations? Consider an example:

<xsd:schema xmlns:xsd="..." xmlns:test="test" targetNamespace="test">
  <xsd:attribute name="att" type="xsd:decimal"/>
  <xsd:element name="ele" test:att="invalid"/>
</xsd:schema>

Then are we supposed to validate "test:att" against the type "xsd:decimal"?

Thanks,
Sandy Gao
Software Developer, IBM Canada
(1-416) 448-3255
sandygao@ca.ibm.com



                                                                                                                   
                    bugzilla@apach                                                                                 
                    e.org                To:     xerces-j-dev@xml.apache.org                                       
                                         cc:                                                                       
                    06/18/2001           Subject:     [Bug 2216] New: - Namespaces for attributes of schema        
                    11:57 AM              elements not processed                                                   
                    Please respond                                                                                 
                    to                                                                                             
                    xerces-j-dev                                                                                   
                                                                                                                   
                                                                                                                   



http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2216

*** shadow/2216           Mon Jun 18 08:57:22 2001
--- shadow/2216.tmp.19557           Mon Jun 18 08:57:22 2001
***************
*** 0 ****
--- 1,38 ----
+
+============================================================================+

+ | Namespaces for attributes of schema elements not processed
|
+
+----------------------------------------------------------------------------+

+ |        Bug #: 2216                        Product: Xerces-J
|
+ |       Status: NEW                         Version: 1.4
|
+ |   Resolution:                            Platform: Other
|
+ |     Severity: Normal                   OS/Version: Other
|
+ |     Priority: Other                     Component: Schema-Structures
|
+
+----------------------------------------------------------------------------+

+ |  Assigned To: xerces-j-dev@xml.apache.org
|
+ |  Reported By: gmann@adobe.com
|
+ |      CC list: Cc:
|
+
+----------------------------------------------------------------------------+

+ |          URL:
|
+
+============================================================================+

+ |                              DESCRIPTION
|
+ Attribute definitions are declared using <xsd:attribute .../>
+ This element contains attributes such as name, use etc.
+
+ If such a definition is extended to contain attributes from another
namespace
+ (ie meta data for processing elsewhere) then the namespace part of those
+ attributes are ignored - they are assumed to be from the XMLSchema
namespace. ie
+
+ <xsd:schema targetNamespace="http://www.CIP4.org/JDFSchema_1"
+ xmlns:jdfP="http://www.CIP4.org/JDFSchema_1/JDFParser"
+ xmlns:jdf="http://www.CIP4.org/JDFSchema_1"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault
="qualified"
+ attributeFormDefault="unqualified">
+ ...
+ <xsd:attribute name="ClipBox" use="optional" jdfP:use="required"/>
+ <xsd:attribute name="ClipBox1" use="optional" jdfP:id="123"/>
+ <xsd:attribute name="ClipBox2" use="optional" jdfP:Token="TrueBox"/>
+
+ when this is validated the first line appears OK,
+ the second fails with "[Error] _test4.xml:17:201: Schema error: Invalid
+ attribute value '123' for 'id' in 'attribute': ID is not valid: 123."
+ the third fails with "[Error] _test4.xml:17:201: Schema error:
+ Attribute 'Tokens' cannot appear in 'attribute'."
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org