You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2001/04/18 20:23:50 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/validators/schema SchemaMessageProvider.java TraverseSchema.java

elena       01/04/18 11:23:50

  Modified:    java/src/org/apache/xerces/msg SchemaMessages.java
               java/src/org/apache/xerces/validators/schema
                        SchemaMessageProvider.java TraverseSchema.java
  Log:
  more on simpleTpe constraints
  
  Revision  Changes    Path
  1.11      +12 -9     xml-xerces/java/src/org/apache/xerces/msg/SchemaMessages.java
  
  Index: SchemaMessages.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/msg/SchemaMessages.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SchemaMessages.java	2001/04/09 20:22:36	1.10
  +++ SchemaMessages.java	2001/04/18 18:23:45	1.11
  @@ -63,7 +63,7 @@
    * This file contains error and warning messages for the Schema validator
    * The messages are arranged in key and value tuples in a ListResourceBundle.
    *
  - * @version $Id: SchemaMessages.java,v 1.10 2001/04/09 20:22:36 neilg Exp $
  + * @version $Id: SchemaMessages.java,v 1.11 2001/04/18 18:23:45 elena Exp $
    */
   public class SchemaMessages extends ListResourceBundle {
       /** The list resource bundle contents. */
  @@ -90,13 +90,13 @@
           { "IllegalAttContent", "Illegal content {0} in attribute group" },
           { "ValueNotInteger", "Value of {0} is not an integer." },
           { "DatatypeError", "Datatype error: {0}." },
  -		{ "TypeAlreadySet", "The type of the element has already been declared." },
  -		{ "GenericError", "Schema error: {0}." },
  -		{ "UnexpectedError", "UnexpectedError" },
  -                {"ContentError", "Content (annotation?,..) is incorrect for type {0}"},
  -                {"AnnotationError", "Annotation can only appear once: type {0}"},
  -                {"ListUnionRestrictionError","List | Union | Restriction content is invalid for type {0}"},
  -		{ "ProhibitedAttributePresent", "An attribute declared \"prohibited\" is present in this element definition." },
  +        { "TypeAlreadySet", "The type of the element has already been declared." },
  +        { "GenericError", "Schema error: {0}." },
  +        { "UnexpectedError", "UnexpectedError" },
  +        {"ContentError", "Content (annotation?,..) is incorrect for type {0}"},
  +        {"AnnotationError", "Annotation can only appear once: type {0}"},
  +        {"ListUnionRestrictionError","List | Union | Restriction content is invalid for type {0}"},
  +        { "ProhibitedAttributePresent", "An attribute declared \"prohibited\" is present in this element definition." },
           // identity constraints
           { "UniqueNotEnoughValues", "Not enough values specified for <unique> identity constraint specified for element \"{0}\"." },
           { "KeyNotEnoughValues", "Not enough values specified for <key name=\"{1}\"> identity constraint specified for element \"{0}\"." },
  @@ -108,7 +108,10 @@
           { "UnknownField", "Internal identity constraint error; unknown field \"{0}\"." },
           { "KeyRefReferNotFound", "Key reference declaration \"{0}\" refers to unknown key with name \"{1}\"." },
           { "FixedDiffersFromActual", "The content of this element is not equivalent to the value of the \"fixed\" attribute in the element's declaration in the schema."}, 
  -       };
  +        // simpleType
  +        {"InvalidBaseType", "itemType \"{0}\" must have a variety of atomic or union"},
  +        
  +    };
       
       /** Returns the list resource bundle contents. */
       public Object[][] getContents() {
  
  
  
  1.11      +16 -12    xml-xerces/java/src/org/apache/xerces/validators/schema/SchemaMessageProvider.java
  
  Index: SchemaMessageProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/schema/SchemaMessageProvider.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SchemaMessageProvider.java	2001/04/09 20:22:38	1.10
  +++ SchemaMessageProvider.java	2001/04/18 18:23:47	1.11
  @@ -155,9 +155,9 @@
           IllegalAttContent = 19,
           ValueNotInteger = 20,
           DatatypeError = 21,
  -		TypeAlreadySet = 22,
  -		GenericError = 23,
  -		UnclassifiedError = 24,
  +        TypeAlreadySet = 22,
  +        GenericError = 23,
  +        UnclassifiedError = 24,
           ContentError = 25,
           AnnotationError = 26,
           ListUnionRestrictionError = 27,
  @@ -174,7 +174,10 @@
           KeyRefReferNotFound = 37,
           // ...
           FixedDiffersFromActual = 38,
  -        MSG_MAX_CODE = 39;
  +        // simpleType
  +        InvalidBaseType = 39,
  +        
  +        MSG_MAX_CODE = 40;
       //
       // Minor Codes
       //
  @@ -197,20 +200,20 @@
           "DatatypeWithType",             //  12, "Datatype qualifiers can only be used if you specify a type attribute."},
           "DatatypeQualUnsupported",      //  13, "The datatype qualifier {0} is not supported."
           "GroupContentRestricted",       //  14, "Error: {0} content must be one of choice, all or sequence.  Saw {1}"
  -        "UnknownBaseDatatype",          //  15, "Unknown base type {0} for type {1}." },
  -        "BadAttWithRef",          //  16, "ref cannot appear with any of type, abstract, block, final, nullable, default or fixed"},
  +        "UnknownBaseDatatype",          //  15, "Unknown base type {0} for type {1}." }, 
  +        "BadAttWithRef",                //  16, "ref cannot appear with any of type, abstract, block, final, nullable, default or fixed"},
           "NoContentForRef",              //  17, "Cannot have child content for an element declaration that has a ref attribute"
           "IncorrectDefaultType",         //  18, "Incorrect type for {0}'s default value: {1}"
           "IllegalAttContent",            //  19, "Illegal content {0} in attribute group"
           "ValueNotInteger",              //  20, "Value of {0} is not an integer"
           "DatatypeError",                //  21, "Datatype error {0}." 
  -		"TypeAlreadySet",				//	22,	"The type of the element has already been declared."
  -		"GenericError",					//	23, "Schema error: {0}."
  -		"UnclassifiedError",			//	24,	"Unclassified error."
  +        "TypeAlreadySet",               //  22, "The type of the element has already been declared."
  +        "GenericError",                 //  23, "Schema error: {0}."
  +        "UnclassifiedError",            //  24, "Unclassified error."
           "ContentError",                 //  25, "Content (annotation?,..) is incorrect for type {0}"
  -        "AnnotationError",                //  26, "Annotation can only appear once: type {0}"
  -        "ListUnionRestrictionError",       //  27, "List | Union | Restriction content is invalid for type {0}"
  -        "ProhibitedAttributePresent",	    		// 	28,	attribue dcld prohibited is present
  +        "AnnotationError",              //  26, "Annotation can only appear once: type {0}"
  +        "ListUnionRestrictionError",    //  27, "List | Union | Restriction content is invalid for type {0}"
  +        "ProhibitedAttributePresent",   //  28, attribue dcld prohibited is present
           // identity constraint keys
           "UniqueNotEnoughValues",
           "KeyNotEnoughValues",
  @@ -222,6 +225,7 @@
           "UnknownField",
           "KeyRefReferNotFound",
           "FixedDiffersFromActual",
  +        "InvalidBaseType",
           // END
       };
   }
  
  
  
  1.128     +11 -10    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.127
  retrieving revision 1.128
  diff -u -r1.127 -r1.128
  --- TraverseSchema.java	2001/04/12 06:21:16	1.127
  +++ TraverseSchema.java	2001/04/18 18:23:48	1.128
  @@ -76,7 +76,8 @@
   import  org.apache.xerces.validators.datatype.DatatypeValidatorFactoryImpl;
   import  org.apache.xerces.validators.datatype.NOTATIONDatatypeValidator;
   import  org.apache.xerces.validators.datatype.StringDatatypeValidator;  
  -import  org.apache.xerces.validators.datatype.UnionDatatypeValidator;  
  +import  org.apache.xerces.validators.datatype.ListDatatypeValidator;
  +import  org.apache.xerces.validators.datatype.UnionDatatypeValidator; 
   import  org.apache.xerces.validators.datatype.InvalidDatatypeValueException;
   import  org.apache.xerces.utils.StringPool;
   import  org.w3c.dom.Element;
  @@ -126,7 +127,7 @@
    *  
    * @see org.apache.xerces.validators.common.Grammar
    *
  - * @version $Id: TraverseSchema.java,v 1.127 2001/04/12 06:21:16 andyc Exp $
  + * @version $Id: TraverseSchema.java,v 1.128 2001/04/18 18:23:48 elena Exp $
    */
   public class TraverseSchema implements 
                               NamespacesScope.NamespacesHandler{
  @@ -1630,16 +1631,16 @@
                   if (union) {
                       dTValidators.addElement((DatatypeValidator)baseValidator); //add validator to structure
                   }
  -                //REVISIT: Should we raise exception here?
  -                // if baseValidator.isInstanceOf(LIST) and UNION
  -                if ( list && (baseValidator instanceof UnionDatatypeValidator)) {
  -                    reportSchemaError(SchemaMessageProvider.UnknownBaseDatatype,
  -                                      new Object [] { simpleTypeDecl.getAttribute( SchemaSymbols.ATT_BASE ),
  -                                          simpleTypeDecl.getAttribute(SchemaSymbols.ATT_NAME)});
  -                    return -1;
  -                }
  +                
               }
           } //end - base is available
  +        
  +        if (list && baseValidator instanceof ListDatatypeValidator) {
  +            reportSchemaError(SchemaMessageProvider.InvalidBaseType,
  +                                      new Object [] { baseTypeQNameProperty,
  +                                          simpleTypeDecl.getAttribute(SchemaSymbols.ATT_NAME)});
  +            return -1;
  +        }
           
           // move to next child 
           // restriction ->[simpleType]->[facets]  OR
  
  
  

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