lmartin     2002/08/26 06:57:48

  Modified:    java/src/org/apache/xerces/impl/xs XSConstraints.java
  Log:
  Move derivation-restriction.5.2 checking to XSConstraints.  Occurrence info for 
local element decls in complextypes isn't valid during complex type traversal
  
  Revision  Changes    Path
  1.26      +19 -7     xml-xerces/java/src/org/apache/xerces/impl/xs/XSConstraints.java
  
  Index: XSConstraints.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XSConstraints.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- XSConstraints.java        18 Jul 2002 20:48:44 -0000      1.25
  +++ XSConstraints.java        26 Aug 2002 13:57:48 -0000      1.26
  @@ -419,25 +419,37 @@
                   }
   
                   // 2. Particle Derivation
  +                
                   if (types[j].fBaseType != null &&
                       types[j].fBaseType != SchemaGrammar.fAnyType &&
                       types[j].fDerivedBy == XSConstants.DERIVATION_RESTRICTION &&
  -                    types[j].fParticle !=null &&
  -                    (types[j].fBaseType instanceof XSComplexTypeDecl) &&
  -                    ((XSComplexTypeDecl)(types[j].fBaseType)).fParticle != null) {
  -                  try {
  +                    (types[j].fBaseType instanceof XSComplexTypeDecl)) {  
  +
  +                  XSParticleDecl derivedParticle=types[j].fParticle;  
  +                  XSParticleDecl baseParticle=  
  +                    ((XSComplexTypeDecl)(types[j].fBaseType)).fParticle;
  +                  if (derivedParticle==null && (!(baseParticle==null ||
  +                                               baseParticle.emptiable()))) {
  +                    reportSchemaError(errorReporter,ctLocators[j],
  +                                      "derivation-ok-restriction.5.2",
  +                                      new Object[]{types[j].fName});
  +                  }
  +                  else if (derivedParticle!=null &&
  +                           baseParticle!=null) 
  +
  +                    try {
                         particleValidRestriction(types[j].fParticle,
                                                  SGHandler,
                                                  
((XSComplexTypeDecl)(types[j].fBaseType)).fParticle,
                                                  SGHandler);
  -                  } catch (XMLSchemaException e) {
  +                    } catch (XMLSchemaException e) {
                         reportSchemaError(errorReporter, ctLocators[j],
                                           e.getKey(),
                                           e.getArgs());
                         reportSchemaError(errorReporter, ctLocators[j],
                                           "derivation-ok-restriction.5.3",
                                           new Object[]{types[j].fName});
  -                  }
  +                    }
                   }
   
                   // 3. UPA
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to