You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2001/10/24 17:07:50 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/v2 XSDKeyrefTraverser.java

sandygao    01/10/24 08:07:50

  Modified:    java/src/org/apache/xerces/impl/msg
                        XMLSchemaMessages.properties
               java/src/org/apache/xerces/impl/v2 XSDKeyrefTraverser.java
  Log:
  A patch from Rahul about a missing constraint of keyref traversal:
  c-props-correct.2
  
  Revision  Changes    Path
  1.25      +4 -3      xml-xerces/java/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties
  
  Index: XMLSchemaMessages.properties
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/msg/XMLSchemaMessages.properties,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- XMLSchemaMessages.properties	2001/10/23 16:49:59	1.24
  +++ XMLSchemaMessages.properties	2001/10/24 15:07:50	1.25
  @@ -230,7 +230,8 @@
           cos-valid-default.2.1 = cos-valid-default.2.1: Element ''{0}'' has a value constraint and must have a mixed or simple content model.
           cos-valid-default.2.2.1 = cos-valid-default.2.2.1: error.
           cos-valid-default.2.2.2 = cos-valid-default.2.2.2: For element ''{0}'', the '{'content type'}' is mixed, then the '{'content type'}'''s particle must be emptiable.
  -        c-props-correct = c-props-correct: error.
  +        c-props-correct.1 = c-props-correct.1: error.
  +        c-props-correct.2 = c-props-correct.2: Cardinality of Fields for keyref ''{0}'' and key ''{1}'' must match.
           c-selector-xpath = c-selector-xpath: error.
           ct-props-correct = ct-props-correct: error.
           derivation-ok-restriction = derivation-ok-restriction: error.
  @@ -283,14 +284,14 @@
   
   # SimpleTypes
      ListUnionRestrictionError = List | Union | Restriction content is invalid for type ''{0}''
  -   dt-unsupported-derivation =  Derivation of type {0} is unsupported. 
  +   dt-unsupported-derivation =  Derivation of type {0} is unsupported.
      dt-simpleType = The content of ''{0}'' named ''{1}'' must match {2}.
      dt-unknown-basetype  = Unknown base type ''{0}'' for a type ''{1}''
      dt-restiction-final = the base type ''{0}'' does not allow itself to be used as the base for a restriction and/or as a type in a list and/or union
      dt-list-itemType = Datatypes 4.1.3: error in the simpleType ''{0}'' itemType attribute or simpleType child constraint
      dt-restriction-base = Datatypes 4.1.3: error in the simpleType ''{0}'' base attribute or simpleType child constraint
      dt-union-memberType = Datatypes 4.1.3: error in the simpleType ''{0}'' - memberTypes attribute or simpleType children constraint
  -   dt-enumeration-notation = Datatypes 3.2.19: enumeration facet value required for NOTATION type in element/attribute ''{0}'' 
  +   dt-enumeration-notation = Datatypes 3.2.19: enumeration facet value required for NOTATION type in element/attribute ''{0}''
   
   
   # Datatypes
  
  
  
  1.9       +11 -5     xml-xerces/java/src/org/apache/xerces/impl/v2/XSDKeyrefTraverser.java
  
  Index: XSDKeyrefTraverser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/XSDKeyrefTraverser.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSDKeyrefTraverser.java	2001/10/17 18:41:33	1.8
  +++ XSDKeyrefTraverser.java	2001/10/24 15:07:50	1.9
  @@ -68,7 +68,7 @@
    * This class contains code that is used to traverse <keyref>s.
    *
    * @author Neil Graham, IBM
  - * @version $Id: XSDKeyrefTraverser.java,v 1.8 2001/10/17 18:41:33 neilg Exp $
  + * @version $Id: XSDKeyrefTraverser.java,v 1.9 2001/10/24 15:07:50 sandygao Exp $
    */
   class XSDKeyrefTraverser extends XSDAbstractIDConstraintTraverser {
   
  @@ -112,10 +112,16 @@
           // add to element decl
           traverseIdentityConstraint(keyRef, krElem, schemaDoc, attrValues);
   
  -        // add key reference to element decl
  -        // and stuff this in the grammar
  -        // REVISIT: should we add IDC to element here?
  -        grammar.addIDConstraintDecl(element, keyRef);
  +        //Schema Component Constraint: Identity-constraint Definition Properties Correct
  +        //2 If the {identity-constraint category} is keyref, the cardinality of the {fields} must equal that of the {fields} of the {referenced key}.
  +        if(key.getFieldCount() != keyRef.getFieldCount()) {
  +            reportSchemaError("c-props-correct.2" , new Object [] {krName,key.getIdentityConstraintName()});
  +        } else {
  +            // add key reference to element decl
  +            // and stuff this in the grammar
  +            grammar.addIDConstraintDecl(element, keyRef);
  +        }
  +
           // and put back attributes
           fAttrChecker.returnAttrArray(attrValues, schemaDoc);
       } // traverse(Element,int,XSDocumentInfo, SchemaGrammar)
  
  
  

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