You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2002/04/15 21:46:25 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs/traversers XSDAbstractIDConstraintTraverser.java

neilg       02/04/15 12:46:25

  Modified:    java/src/org/apache/xerces/impl/msg
                        XMLSchemaMessages.properties
               java/src/org/apache/xerces/impl/xpath XPath.java
                        XPathException.java
               java/src/org/apache/xerces/impl/xs/identity Selector.java
               java/src/org/apache/xerces/impl/xs/traversers
                        XSDAbstractIDConstraintTraverser.java
  Log:
  cleaning up hardcoded error message strings in the identity constraint code.
  
  Revision  Changes    Path
  1.48      +100 -38   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.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- XMLSchemaMessages.properties	12 Apr 2002 15:19:28 -0000	1.47
  +++ XMLSchemaMessages.properties	15 Apr 2002 19:46:24 -0000	1.48
  @@ -1,36 +1,78 @@
   # This file contains error and warning messages related to XML Schema
   # The messages are arranged in key and value tuples in a ListResourceBundle.
   #
  -# @version
  +# @version $Id: XMLSchemaMessages.properties,v 1.48 2002/04/15 19:46:24 neilg Exp $
   
           BadMessageKey = The error message corresponding to the message key can not be found.
           FormatFailed = An internal error occurred while formatting the following message:\n
   
  -# For internal use
  +# old stuff
   
  -        Internal-Error = Internal error: {0}.
  -        dt-whitespace = Whitespace facet value is not available for the union simpleType ''{0}''
  -        GrammarConflict = One of the grammar(s) returned from the user's grammar pool is in conflict with another grammar.
  +        NoValidatorFor = No validator for datatype {0}.
  +        IncorrectDatatype = Incorrect datatype: {0}.
  +        NotADatatype = {0} is not a datatype.
  +        TextOnlyContentWithType = The content attribute must be 'textOnly' if you specify a type attribute.
  +        NestedOnlyInElemOnly = Nested Element decls only allowed in elementOnly content.
  +        EltRefOnlyInMixedElemOnly = Element references only allowed in mixed or elementOnly content.
  +        OnlyInEltContent = {0} only allowed in elementOnly content.
  +        OrderIsAll = {0} not allowed if the order is all.
  +        DatatypeWithType = Datatype qualifiers can only be used if you specify a type attribute.
  +        DatatypeQualUnsupported = The datatype qualifier {0} is not supported.
  +        GroupContentRestricted = Error: {0} content must be one of choice, all or sequence.  Saw {1}.
  +        UnknownBaseDatatype = Unknown base type {0} for type {1}.
  +        BadAttWithRef = cannot use ref with any of type, block, final, abstract, nillable, default or fixed.
  +        NoContentForRef = Cannot have child content for an element declaration that has a ref attribute.
  +        IncorrectDefaultType = Incorrect type for {0}'s default value: {1} .
  +        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.
   
   # Identity constraints
  -
  -        AbsentKeyValue = Identity Constraint error (cvc-identity-constraint.4.2.1):  element \"{0}\" has a key with no value.
  +        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}\".
  +        KeyRefNotEnoughValues = Not enough values specified for <keyref name=\"{1}\"> identity constraint specified for element \"{0}\".
           DuplicateField = Duplicate match in scope for field \"{0}\".
  -        DuplicateKey = Duplicate key value [{0}] declared for identity constraint of element \"{1}\".
           DuplicateUnique = Duplicate unique value [{0}] declared for identity constraint of element \"{1}\".
  -        FieldMultipleMatch = Identity constraint error:  field \"{0}\" matches more than one value within the scope of its selector; fields must match unique values.
  -        FixedDiffersFromActual = The content of this element is not equivalent to the value of the \"fixed\" attribute in the element's declaration in the schema.
  -        KeyMatchesNillable = Identity Constraint error (cvc-identity-constraint.4.2.3):  element \"{0}\" has a key which matches an element which has nillable set to true.
  -        KeyNotEnoughValues = Not enough values specified for <key name=\"{1}\"> identity constraint specified for element \"{0}\".
  +        DuplicateKey = Duplicate key value [{0}] declared for identity constraint of element \"{1}\".
           KeyNotFound = Key with value [{0}] not found for identity constraint of element \"{1}\".
  -        KeyRefNotEnoughValues = Not enough values specified for <keyref name=\"{1}\"> identity constraint specified for element \"{0}\".
  -        KeyRefOutOfScope = Identity Constraint error:  identity constraint \"{0}\" has a keyref which refers to a key or unique that is out of scope.
  -        KeyRefReferNotFound = Key reference declaration \"{0}\" refers to unknown key with name \"{1}\".
  -        UniqueNotEnoughValues = Not enough values specified for <unique> identity constraint specified for element \"{0}\".
           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.
   
  -# Ideally, we should only use the following error keys, not the ones under
  -# "Identity constraints". And we should cover all of the following errors.
  +
  +# SimpleType
  +
  +
  +        InvalidBaseType = itemType \"{0}\" must have a variety of atomic or union.
  +        FieldMultipleMatch = Identity constraint error:  field \"{0}\" matches more than one value within the scope of its selector; fields must match unique values.
  +        KeyRefOutOfScope = Identity Constraint error:  identity constraint \"{0}\" has a keyref which refers to a key or unique that is out of scope.
  +        AbsentKeyValue = Identity Constraint error (cvc-identity-constraint.4.2.1):  element \"{0}\" has a key with no value.
  +        KeyMatchesNillable = Identity Constraint error (cvc-identity-constraint.4.2.3):  element \"{0}\" has a key which matches an element which has nillable set to true.
  +        BadMinMaxForAllElem = cos-all-limited.2:  The {0} attribute of an element in an all schema component must have the value zero or one.  The value \"{1}\" is incorrect.
  +        BadMinMaxForGroupWithAll = Error:  cos-all-limited.1.2:  The {0} attribute in a reference to a named model group whose content model is \"all\" must have the value one.  The value \"{1}\" is incorrect.
  +        SeqChoiceContentRestricted = Error:  {0} content must be zero or more of element, group, choice, sequence or any.  Saw \"{1}\".
  +        AllContentRestricted = Error:  The content of all is restricted to zero or more elements.  Saw \"{0}\".
  +        AllContentLimited = Error:  cos-all-limited.1.2: A group whose content is \"all\" must only appear as the content type of a complex type definition.  Saw group in \"{0}\".
  +        MinMaxOnGroupChild = Error:  The child ''{1}'' of the named group definition ''{0}'' must not specify either the minOccurs or maxOccurs attribute.
  +        BadMinMaxForAllGp = Error:  cos-all-limited.1.2:  The {0} attribute of a model group with \"all\" compositor that is part of a pair that is the content type of a complex type definition must have the value one.  The value \"{1}\" is incorrect.
  +        UniqueParticleAttribution = Error: cos-nonambig: ({0}) and ({1}) violate the \"Unique Particle Attribution\" rule.
  +        Con3X3ElementAppearance = Error: constraint 3.x.3: Element ''{0}'' cannot appear here.
  +        Con3X3AttributeAppearance = Error: constraint 3.x.3: Attribute ''{1}'' cannot appear in element ''{0}''.
  +        Con3X3AttributeMustAppear = Error: constraint 3.x.3: Attribute ''{1}'' must appear in element ''{0}''.
  +        Con3X3AttributeInvalidValue = Error: constraint 3.x.3: Invalid attribute value for ''{1}'' in element ''{0}'': {2}.
  +
  +# ideally, we should only use the following error keys, not the ones
  +# under "old stuff". and we should cover all of the following errors.
  +
  +        General = schema error: {0}.
  +        Internal-Error = Internal error: {0}.
   
   #validation (3.X.4)
   
  @@ -42,7 +84,7 @@
           cvc-attribute.4 = cvc-attribute.4: The value ''{2}'' of attribute ''{1}'' on element ''{0}'' is not valid with respect to its fixed '{'value constraint'}'.
           cvc-au = cvc-au: error.
           cvc-complex-type.1 = cvc-complex-type.1: error.
  -        cvc-complex-type.2.1 = cvc-complex-type.2.1: Element ''{0}'' must have no character or element information item [children], because the type's content type is empty.
  +        cvc-complex-type.2.1 = cvc-complex-type.2.1: Element ''{0}'' must have no character or element information item [children], becaues the type's content type is empty.
           cvc-complex-type.2.2 = cvc-complex-type.2.2: Element ''{0}'' must have no element [children], and the value must be valid.
           cvc-complex-type.2.3 = cvc-complex-type.2.3: Element ''{0}'' must have no character [children], because the type's content type is element-only.
           cvc-complex-type.2.4.a = cvc-complex-type.2.4.a: Invalid content starting with element ''{0}''. The content must match ''{1}''.
  @@ -157,10 +199,9 @@
           src-resolve = src-resolve: Cannot resolve the name ''{0}'' to a(n) {1} component.
           src-resolve.4 = src-resolve.4: Components from namespace ''{1}'' are not referenceable from schema document ''{0}''.
           src-restriction-base-or-simpleType = src-restriction-base-or-simpleType: error.
  -        src-simple-type.2 = src-simple-type.2: <restriction> must have a base [attribute] or a <simpleType> among its [children], but not both.
  -        src-simple-type.3 = src-simple-type.3: <list> must have an itemType [attribute] or a <simpleType> among its [children], but not both.
  +        src-simple-type = src-simple-type: error.
           src-single-facet-value = src-single-facet-value: {0}
  -        src-union-memberTypes-or-simpleTypes = src-union-memberTypes-or-simpleTypes: Either the memberTypes [attribute] of the <union> element must be non-empty or there must be at least one simpleType [child].
  +        src-union-memberTypes-or-simpleTypes = src-union-memberTypes-or-simpleTypes: error.
           src-wildcard = src-wildcard: error {0}.
           st-restrict-facets = st-restrict-facets: error.
   
  @@ -173,9 +214,8 @@
           a-props-correct.3 = a-props-correct.3: There must not be a '{'value constraint'}' on attribute ''{0}'', because its '{'type definition'}' is or is derived from ID.
           au-props-correct.1 = au-props-correct.1: error.
           au-props-correct.2 = au-props-correct.2: The '{'value constraint'}' of the reference to attribute ''{0}'' must be fixed and its value must match the '{'value constraint'}' of ''{0}''.
  -        c-fields-xpaths = c-fields-xpaths: The field value = ''{0}'' is not a valid: {1}.
  -        cos-all-limited.1.2 = cos-all-limited.1.2: An ''all'' model group must appear in a particle with '{'min occurs'}'='{'max occurs'}'=1, and that particle must be part of a pair which constitutes the '{'content type'}' of a complex type definition.
  -        cos-all-limited.2 = cos-all-limited.2: The '{'max occurs'}' of an element in an ''all'' model group must be 0 or 1.
  +        cos-all-limited = cos-all-limited: error.
  +        cos-all-limited.1.2 = cos-all-limited.1.2:  Error for type ''{0}''.  An all group must comprise the content of the model group.
           cos-applicable-facets = cos-applicable-facets: Facet ''{0}'' is not allowed by this type.
           cos-aw-intersect = cos-aw-intersect: error.
           cos-aw-union = cos-aw-union: error.
  @@ -204,7 +244,6 @@
           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.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: The selector value = ''{0}'' is not a valid: {1}.
           ct-props-correct = ct-props-correct: error.
           ct-props-correct.4 = ct-props-correct.4: Error for type ''{0}''.  Duplicate attribute uses with the same name and target namespace are specified.  Name of duplicate attribute use is ''{1}''.
           ct-props-correct.5 = ct-props-correct.5: Error for type ''{0}''.  Two attribute declarations, ''{1}'' and ''{2}'' have types which derived from ID.
  @@ -305,21 +344,44 @@
   
   #schema for Schemas
   
  -        s4s-att-invalid-value = s4s-att-invalid-value: Invalid attribute value for ''{1}'' in element ''{0}'': {2}.
  -        s4s-att-must-appear = s4s-att-must-appear: Attribute ''{1}'' must appear in element ''{0}''.
           s4s-att-not-allowed = s4s-att-not-allowed: Attribute ''{1}'' cannot appear in element ''{0}''.
  +        s4s-att-must-appear = s4s-att-must-appear: Attribute ''{1}'' must appear in element ''{0}''.
  +        s4s-att-invalid-value = s4s-att-invalid-value: Invalid attribute value for ''{1}'' in element ''{0}'': {2}.
  +        s4s-elt-schema-ns = s4s-elt-schema-ns: The namespace of element ''{0}'' must be from the schema namespace.
           s4s-elt-invalid = s4s-elt-invalid: Element ''{0}'' is not a valid element in schema document.
           s4s-elt-must-match = s4s-elt-must-match: The content of ''{0}'' must match {1}.
  -        s4s-elt-schema-ns = s4s-elt-schema-ns: The namespace of element ''{0}'' must be from the schema namespace.
   
   # codes not defined by the spec
   
  -    EmptyTargetNamespace = EmptyTargetNamespace: In schea document ''{0}'', the value of the targetNamespace attribute cannot be empty string.
  -    FacetValueFromBase = FacetValueFromBase: Value ''{0}'' of facet ''{1}'' must be from the value space of the base type.
  -    FixedFacetValue = FixedFacetValue: ''{0}'' value = ''{1}'' must be equal to that of the base type ''{2}'' when '{'fixed'}' = true.
  -    InvalidRegex = InvalidRegex: Pattern value ''{0}'' is not a valid regular expression: ''{1}''.
  -    SchemaLocation = SchemaLocation: schemaLocation value = ''{0}'' must have even number of URI's.
  -    TargetNamespace.1 = TargetNamespace.1: Expecting namespace ''{0}'', but the target namespace of the schema document is ''{1}''.
  -    TargetNamespace.2 = TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace.
  -    UndeclaredEntity = UndeclaredEntity: Entity ''{0}'' is not declared.
  -    UndeclaredPrefix = UndeclaredPrefix: Cannot resolve ''{0}'' as a QName: the prefix ''{1}'' is not declared.
  +        c-fields-xpaths = c-fields-xpaths: The field value = ''{0}'' is not valid.
  +        c-general-xpath = c-general-xpath:  The expression ''{0}'' is not valid with respect to the XPath subset supported by XML Schema.
  +        c-general-xpath-ns = c-general-xpath-ns:  a namespace prefix in XPath expression ''{0}'' was not bound to a namespace.
  +        c-selector-xpath = c-selector-xpath: The selector value = ''{0}'' is not valid; selector xpaths cannot contain attributes.
  +        declaration-not-found = declaration-not-found: component {0} with name {1} was not found.
  +        EmptyTargetNamespace = EmptyTargetNamespace: In schea document ''{0}'', the value of the targetNamespace attribute cannot be empty string.
  +        FacetValueFromBase = FacetValueFromBase: Value ''{0}'' of facet ''{1}'' must from the value space of the base type.
  +        FixedFacetValue = FixedFacetValue: ''{0}'' value = ''{1}'' must be equal to that of the base type ''{2}'' when '{'fixed'}' = true.
  +        InvalidRegex = InvalidRegex: Pattern value ''{0}'' is not a valid regular expression: ''{1}''.
  +        SchemaLocation = SchemaLocation: schemaLocation value = ''{0}'' must have even number of URI's.
  +        TargetNamespace.1 = TargetNamespace.1: Expecting namespace ''{0}'', but the target namespace of the schema document is ''{1}''.
  +        TargetNamespace.2 = TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace.
  +        UndeclaredPrefix = UndeclaredPrefix: Cannot resolve ''{0}'' as a QName: the prefix ''{1}'' is not declared.
  +        UndeclaredEntity = UndeclaredEntity: Entity ''{0}'' is not declared.
  +        ValidationRoot = ValidationRoot: Validation Root Valid (ID/IDREF) (�3.3.4): validation was not successful.
  +
  +# SimpleTypes
  +        ListUnionRestrictionError = List | Union | Restriction content is invalid for type ''{0}''
  +        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-whitespace = Whitespace facet value is not available for the union simpleType ''{0}''
  +
  +
  +# Datatypes
  +        DatatypeFacetError = Invalid facet: ''{0}''
  +        WhitespaceFacetError = whiteSpace value ''{0}'' for this type must be collapse.
  
  
  
  1.5       +21 -39    xml-xerces/java/src/org/apache/xerces/impl/xpath/XPath.java
  
  Index: XPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xpath/XPath.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XPath.java	27 Mar 2002 23:09:51 -0000	1.4
  +++ XPath.java	15 Apr 2002 19:46:24 -0000	1.5
  @@ -66,7 +66,7 @@
    * Bare minimum XPath parser.
    *
    * @author Andy Clark, IBM
  - * @version $Id: XPath.java,v 1.4 2002/03/27 23:09:51 neilg Exp $
  + * @version $Id: XPath.java,v 1.5 2002/04/15 19:46:24 neilg Exp $
    */
   public class XPath {
   
  @@ -182,21 +182,7 @@
                       super.addToken(tokens, token);
                       return;
                   }
  -                StringBuffer str = new StringBuffer();
  -                str.append("token not supported: ");
  -                String tokenName = tokens.getTokenName(token);
  -                if (tokenName != null) {
  -                    str.append('"');
  -                    str.append(tokenName);
  -                    str.append('"');
  -                }
  -                else {
  -                    str.append('(');
  -                    str.append(token);
  -                    str.append(')');
  -                }
  -                String message = str.toString();
  -                throw new XPathException(message);
  +                throw new XPathException("c-general-xpath");
               }
           };
   
  @@ -218,12 +204,12 @@
               switch (token) {
                   case  XPath.Tokens.EXPRTOKEN_OPERATOR_UNION :{
                       if (i == 0) {
  -                        throw new XPathException("not allowed to have '|' at the beginning of an xpath value");
  +                        throw new XPathException("c-general-xpath");
                       }
   
                       int size = stepsVector.size();
                       if (size == 0) {
  -                        throw new XPathException("not allowed to have '||'");
  +                        throw new XPathException("c-general-xpath");
                       }
                       Step[] steps = new Step[size];
                       stepsVector.copyInto(steps);
  @@ -242,17 +228,14 @@
                   case XPath.Tokens.EXPRTOKEN_ATSIGN: {
                       // consume QName token
                       if (i == tokenCount - 1) {
  -                        throw new XPathException("missing attribute name");
  +                        throw new XPathException("c-general-xpath");
                       }
                       token = xtokens.getToken(++i);
   
                       if (token != XPath.Tokens.EXPRTOKEN_NAMETEST_QNAME
                           && token!= XPath.Tokens.EXPRTOKEN_NAMETEST_ANY
                           && token!=  XPath.Tokens.EXPRTOKEN_NAMETEST_NAMESPACE) {
  -                        throw new XPathException("expected \""+xtokens.getTokenName(XPath.Tokens.EXPRTOKEN_NAMETEST_QNAME)+
  -                                                 "\" or \""+xtokens.getTokenName( XPath.Tokens.EXPRTOKEN_NAMETEST_ANY)+
  -                                                 "\" or \""+xtokens.getTokenName( XPath.Tokens.EXPRTOKEN_NAMETEST_NAMESPACE)+
  -                                                 "\", found "+xtokens.getTokenName(token));
  +                        throw new XPathException("c-general-xpath");
                       }
                       boolean isNamespaceAtt=false;
                       switch (token)
  @@ -276,7 +259,7 @@
                           uri = context.getURI(prefix);
                       }
                       if (prefix != emptySymbol && context != null && uri == null) {
  -                        throw new XPathException("prefix "+prefix+" not bound to namespace URI");
  +                        throw new XPathException("c-general-xpath-ns");
                       }
   
                               if (isNamespaceAtt)
  @@ -313,7 +296,7 @@
                   /***/
                   case XPath.Tokens.EXPRTOKEN_DOUBLE_COLON: {
                       // should never have a bare double colon
  -                    throw new XPathException("Not allowed to have double colon here");
  +                    throw new XPathException("c-general-xpath");
                   }
                   /***
                   case XPath.Tokens.EXPRTOKEN_NAMETEST_ANY: {
  @@ -325,8 +308,7 @@
                       // consume "::" token and drop through
                       i++;
                       if (i == tokenCount - 1) {
  -                        throw new XPathException("expected step following '"
  -                            +xtokens.getTokenName(XPath.Tokens.EXPRTOKEN_AXISNAME_CHILD)+"::'");
  +                        throw new XPathException("c-general-xpath");
                       }
                       firstTokenOfLocationPath=false;
                       break;
  @@ -352,7 +334,7 @@
                           uri = context.getURI(prefix);
                       }
                       if (prefix != emptySymbol && context != null && uri == null) {
  -                        throw new XPathException("prefix "+prefix+" not bound to namespace URI");
  +                        throw new XPathException("c-general-xpath-ns");
                       }
   
                       if (isNamespace)
  @@ -398,12 +380,12 @@
                           if (token == XPath.Tokens.EXPRTOKEN_OPERATOR_DOUBLE_SLASH){
                               i++;
                               if (i == tokenCount - 1) {
  -                                throw new XPathException("expected step following '//'");
  +                                throw new XPathException("c-general-xpath");
                               }
                               if (i+1<tokenCount)	{
                                   token=xtokens.getToken(i+1);
                                   if (token==XPath.Tokens.EXPRTOKEN_OPERATOR_SLASH)
  -                                    throw new XPathException("'/' not allowed after '//'");
  +                                    throw new XPathException("c-general-xpath");
                               }
                               // build step
                               axis = new Axis(Axis.DESCENDANT);
  @@ -417,18 +399,18 @@
                   }
   
                   case XPath.Tokens.EXPRTOKEN_OPERATOR_DOUBLE_SLASH:{
  -                    throw new XPathException("'//' only allowed after '.' at the beginning of an xpath");
  +                    throw new XPathException("c-general-xpath");
                   }
                   case XPath.Tokens.EXPRTOKEN_OPERATOR_SLASH: {
                       if (i == 0) {
  -                        throw new XPathException("not allowed to have '/' at the beginning of an xpath value");
  +                        throw new XPathException("c-general-xpath");
                       }
                       // keep on truckin'
                       if (firstTokenOfLocationPath) {
  -                        throw new XPathException("not allowed to select the root");
  +                        throw new XPathException("c-general-xpath");
                       }
                       if (i == tokenCount - 1) {
  -                        throw new XPathException("expected step following '/'");
  +                        throw new XPathException("c-general-xpath");
                       }
                       firstTokenOfLocationPath=false;
                       break;
  @@ -441,9 +423,9 @@
           int size = stepsVector.size();
           if (size == 0) {
               if (locationPathsVector.size()==0)
  -            throw new XPathException("empty xpath expression");
  +            throw new XPathException("c-general-xpath");
               else
  -                throw new XPathException("xpath cannot end with '|'");
  +                throw new XPathException("c-general-xpath");
           }
           Step[] steps = new Step[size];
           stepsVector.copyInto(steps);
  @@ -776,7 +758,7 @@
        * @author Glenn Marcy, IBM
        * @author Andy Clark, IBM
        *
  -     * @version $Id: XPath.java,v 1.4 2002/03/27 23:09:51 neilg Exp $
  +     * @version $Id: XPath.java,v 1.5 2002/04/15 19:46:24 neilg Exp $
        */
       private static final class Tokens {
   
  @@ -1251,7 +1233,7 @@
        * @author Glenn Marcy, IBM
        * @author Andy Clark, IBM
        *
  -     * @version $Id: XPath.java,v 1.4 2002/03/27 23:09:51 neilg Exp $
  +     * @version $Id: XPath.java,v 1.5 2002/04/15 19:46:24 neilg Exp $
        */
       private static class Scanner {
   
  @@ -1470,7 +1452,7 @@
                           starIsMultiplyOperator = true;
                           currentOffset++;
                       } else {                    // '.'
  -                        throw new XPathException ("Invalid character following '.'");
  +                        throw new XPathException ("c-general-xpath");
                       }
                       if (currentOffset == endOffset) {
                           break;
  
  
  
  1.4       +14 -4     xml-xerces/java/src/org/apache/xerces/impl/xpath/XPathException.java
  
  Index: XPathException.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xpath/XPathException.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XPathException.java	29 Jan 2002 01:15:14 -0000	1.3
  +++ XPathException.java	15 Apr 2002 19:46:24 -0000	1.4
  @@ -62,11 +62,15 @@
    *
    * @author Andy Clark, IBM
    *
  - * @version $Id: XPathException.java,v 1.3 2002/01/29 01:15:14 lehors Exp $
  + * @version $Id: XPathException.java,v 1.4 2002/04/15 19:46:24 neilg Exp $
    */
   public class XPathException 
       extends Exception {
   
  +    // Data
  +
  +    // hold the value of the key this Exception refers to.
  +    private String fKey;
       //
       // Constructors
       //
  @@ -74,11 +78,17 @@
       /** Constructs an exception. */
       public XPathException() {
           super();
  +        fKey = "c-general-xpath";
       } // <init>()
   
  -    /** Constructs an exception with the specified message. */
  -    public XPathException(String message) {
  -        super(message);
  +    /** Constructs an exception with the specified key. */
  +    public XPathException(String key) {
  +        super();
  +        fKey = key;
       } // <init>(String)
  +
  +    public String getKey() {
  +        return fKey;
  +    } // getKey():  String
   
   } // class XPathException
  
  
  
  1.4       +3 -3      xml-xerces/java/src/org/apache/xerces/impl/xs/identity/Selector.java
  
  Index: Selector.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/identity/Selector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Selector.java	29 Jan 2002 01:15:15 -0000	1.3
  +++ Selector.java	15 Apr 2002 19:46:24 -0000	1.4
  @@ -73,7 +73,7 @@
    * Schema identity constraint selector.
    *
    * @author Andy Clark, IBM
  - * @version $Id: Selector.java,v 1.3 2002/01/29 01:15:15 lehors Exp $
  + * @version $Id: Selector.java,v 1.4 2002/04/15 19:46:24 neilg Exp $
    */
   public class Selector {
   
  @@ -136,7 +136,7 @@
        * Schema identity constraint selector XPath expression.
        *
        * @author Andy Clark, IBM
  -     * @version $Id: Selector.java,v 1.3 2002/01/29 01:15:15 lehors Exp $
  +     * @version $Id: Selector.java,v 1.4 2002/04/15 19:46:24 neilg Exp $
        */
       public static class XPath
       extends org.apache.xerces.impl.xpath.XPath {
  @@ -162,7 +162,7 @@
                   org.apache.xerces.impl.xpath.XPath.Axis axis =
                   fLocationPaths[i].steps[fLocationPaths[i].steps.length-1].axis;
                   if (axis.type == axis.ATTRIBUTE) {
  -                    throw new XPathException("selectors cannot select attributes");
  +                    throw new XPathException("c-selector-xpath");
                   }
               }
   
  
  
  
  1.6       +3 -3      xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java
  
  Index: XSDAbstractIDConstraintTraverser.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractIDConstraintTraverser.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSDAbstractIDConstraintTraverser.java	15 Feb 2002 22:08:48 -0000	1.5
  +++ XSDAbstractIDConstraintTraverser.java	15 Apr 2002 19:46:24 -0000	1.6
  @@ -69,7 +69,7 @@
    * traversers (the XSDUniqueTraverser, XSDKeyTraverser and
    * XSDKeyrefTraverser) rely upon.
    *
  - * @version $Id: XSDAbstractIDConstraintTraverser.java,v 1.5 2002/02/15 22:08:48 sandygao Exp $
  + * @version $Id: XSDAbstractIDConstraintTraverser.java,v 1.6 2002/04/15 19:46:24 neilg Exp $
    */
   class XSDAbstractIDConstraintTraverser extends XSDAbstractTraverser {
   
  @@ -141,7 +141,7 @@
               ic.setSelector(selector);
           }
           catch (XPathException e) {
  -            reportSchemaError("c-selector-xpath", new Object[]{sText, e.getLocalizedMessage()}, sElem);
  +            reportSchemaError(e.getKey(), new Object[]{sText}, sElem);
               // put back attr values...
               fAttrChecker.returnAttrArray(attrValues, schemaDoc);
               return;
  @@ -187,7 +187,7 @@
                   ic.addField(field);
               }
               catch (XPathException e) {
  -                reportSchemaError("c-fields-xpaths", new Object[]{fText, e.getLocalizedMessage()}, fElem);
  +                reportSchemaError(e.getKey(), new Object[]{fText}, fElem);
                   // put back attr values...
                   fAttrChecker.returnAttrArray(attrValues, schemaDoc);
                   return;
  
  
  

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