xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eri...@locus.apache.org
Subject cvs commit: xml-xerces/java/src/org/apache/xerces/validators/schema TraverseSchema.java
Date Fri, 14 Jul 2000 03:54:11 GMT
ericye      00/07/13 20:54:11

  Modified:    java/src/org/apache/xerces/validators/schema
                        TraverseSchema.java
  Log:
  Added full equivClass support in Content Models and validation
  --ericye
  
  Revision  Changes    Path
  1.39      +26 -17    xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSchema.java
  
  Index: TraverseSchema.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/TraverseSchema.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- TraverseSchema.java	2000/07/13 23:20:34	1.38
  +++ TraverseSchema.java	2000/07/14 03:54:09	1.39
  @@ -374,7 +374,7 @@
    *  
    * @see                  org.apache.xerces.validators.common.Grammar
    *
  - * @version $Id: TraverseSchema.java,v 1.38 2000/07/13 23:20:34 ericye Exp $
  + * @version $Id: TraverseSchema.java,v 1.39 2000/07/14 03:54:09 ericye Exp $
    */
   
   public class TraverseSchema implements 
  @@ -1797,19 +1797,19 @@
               if (! fElementRecurseComplex.isEmpty() ) {
                   Enumeration e = fElementRecurseComplex.keys();
                   while( e.hasMoreElements() ) {
  -                    String nameThenScope = (String) e.nextElement();
  +                    QName nameThenScope = (QName) e.nextElement();
                       String typeName = (String) fElementRecurseComplex.get(nameThenScope);
  -                    int comma = nameThenScope.indexOf(",");
  -                    String eltName = nameThenScope.substring(0, comma);
  -                    int enclosingScope = Integer.parseInt(nameThenScope.substring(comma+1));
  +
  +                    int eltUriIndex = nameThenScope.uri;
  +                    int eltNameIndex = nameThenScope.localpart;
  +                    int enclosingScope = nameThenScope.prefix;
                       ComplexTypeInfo typeInfo = 
                           (ComplexTypeInfo) fComplexTypeRegistry.get(fTargetNSURIString+","+typeName);
                       if (typeInfo==null) {
                           throw new Exception ( "Internal Error in void checkRecursingComplexType().
" );
                       }
                       else {
  -                        int nameIndex = fStringPool.addSymbol(eltName);
  -                        int elementIndex = fSchemaGrammar.addElementDecl(new QName(-1,
nameIndex, nameIndex, -1), 
  +                        int elementIndex = fSchemaGrammar.addElementDecl(new QName(-1,
eltNameIndex, eltNameIndex, eltUriIndex), 
                                                                            enclosingScope,
typeInfo.scopeDefined, 
                                                                            typeInfo.contentType,

                                                                            typeInfo.contentSpecHandle,

  @@ -2690,14 +2690,28 @@
                   if (typeInfo == null) {
                       dv = fDatatypeRegistry.getDatatypeValidator(localpart);
                       if (dv == null )
  -                    if (!typeURI.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA)) {
  +                    if (typeURI.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA)
  +                        && !fTargetNSURIString.equals(SchemaSymbols.URI_SCHEMAFORSCHEMA))

  +                    {
  +                        noErrorSoFar = false;
  +                        // REVISIT: Localize
  +                        reportGenericSchemaError("type not found : " + typeURI+":"+localpart);
  +                    }
  +                    else {
                           Element topleveltype = getTopLevelComponentByName(SchemaSymbols.ELT_COMPLEXTYPE,localpart);
                           if (topleveltype != null) {
                               if (fCurrentTypeNameStack.search((Object)localpart) > -
1) {
                                   //then we found a recursive element using complexType.
                                   // REVISIT: this will be broken when recursing happens
between 2 schemas
  -                                fElementRecurseComplex.put(name+","+fCurrentScope, localpart);
  -                                return new QName(-1, fStringPool.addSymbol(name), fStringPool.addSymbol(name),
-1);
  +                                int uriInd = -1;
  +                                if ( isQName.equals(SchemaSymbols.ATTVAL_QUALIFIED)||
  +                                     fElementDefaultQualified) {
  +                                    uriInd = fTargetNSURI;
  +                                }
  +                                int nameIndex = fStringPool.addSymbol(name);
  +                                QName tempQName = new QName(fCurrentScope, nameIndex, nameIndex,
uriInd);
  +                                fElementRecurseComplex.put(tempQName, localpart);
  +                                return new QName(-1, nameIndex, nameIndex, uriInd);
                               }
                               else {
                                   typeNameIndex = traverseComplexTypeDecl( topleveltype );
  @@ -2721,11 +2735,6 @@
                           }
   
                       }
  -                    else {
  -                        noErrorSoFar = false;
  -                        // REVISIT: Localize
  -                        reportGenericSchemaError("type not found : " + typeURI+":"+localpart);
  -                    }
                   }
               }
      
  @@ -2823,10 +2832,10 @@
           if ( DEBUGGING ) {
               /***/
               System.out.println("########elementIndex:"+elementIndex+" ("+fStringPool.toString(eltQName.uri)+","
  -                               + elementDecl.getAttribute(SchemaSymbols.ATT_NAME) + ")"+
  +                               + fStringPool.toString(eltQName.localpart) + ")"+
                                  " eltType:"+type+" contentSpecType:"+contentSpecType+
                                  " SpecNodeIndex:"+ contentSpecNodeIndex +" enclosingScope:
" +enclosingScope +
  -                               " scopeDefined: " +scopeDefined);
  +                               " scopeDefined: " +scopeDefined+"\n");
                /***/
           }
   
  
  
  

Mime
View raw message