You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by je...@locus.apache.org on 2000/11/24 18:39:25 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes IDDatatypeValidator.java
jeffreyr 00/11/24 09:39:25
Modified: java/src/org/apache/xerces/impl Tag: xerces_j_2
XMLValidator.java
java/src/org/apache/xerces/impl/msg Tag: xerces_j_2
XMLMessages.properties
java/src/org/apache/xerces/impl/validation Tag: xerces_j_2
InvalidDatatypeValueException.java
java/src/org/apache/xerces/impl/validation/datatypes Tag:
xerces_j_2 IDDatatypeValidator.java
Log:
fixed exception messages to errorreporter
Revision Changes Path
No revision
No revision
1.1.2.40 +10 -9 xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java
Index: XMLValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/Attic/XMLValidator.java,v
retrieving revision 1.1.2.39
retrieving revision 1.1.2.40
diff -u -r1.1.2.39 -r1.1.2.40
--- XMLValidator.java 2000/11/23 00:46:08 1.1.2.39
+++ XMLValidator.java 2000/11/24 17:39:18 1.1.2.40
@@ -104,7 +104,7 @@
* @author Andy Clark, IBM
* @author Jeffrey Rodriguez IBM
*
- * @version $Id: XMLValidator.java,v 1.1.2.39 2000/11/23 00:46:08 jeffreyr Exp $
+ * @version $Id: XMLValidator.java,v 1.1.2.40 2000/11/24 17:39:18 jeffreyr Exp $
*/
public class XMLValidator
implements XMLComponent,
@@ -1761,7 +1761,7 @@
* @return normalized attribute value
*/
private String validateDTDattribute(QName element, String attValue,
- XMLAttributeDecl attributeDecl) {
+ XMLAttributeDecl attributeDecl) throws SAXException {
//AttributeValidator av = null;
switch (attributeDecl.simpleType.type) {
@@ -1845,11 +1845,12 @@
try {
fValID.validate( value, null );
} catch (InvalidDatatypeValueException ex) {
- /*
- reportRecoverableXMLError(ex.getMajorCode(),
- ex.getMinorCode(),
- fStringPool.toString( attributeDecl.name.rawname), value );
- */
+ String key = ex.getKeyIntoReporter();
+
+ fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN,
+ key,
+ new Object[]{ ex.getMessage()},
+ XMLErrorReporter.SEVERITY_ERROR );
}
/*
if (fNormalizeAttributeValues && value != unTrimValue) {
@@ -2361,13 +2362,13 @@
//Initialize ID, IDREF, IDREFS validators
- if( fTableOfIDs == null ){
+ if (fTableOfIDs == null) {
fTableOfIDs = new Hashtable();//Initialize table of IDs
}
fValID.initialize(fTableOfIDs);
fValIDRef.initialize(fTableOfIDs);
fValIDRefs.initialize(fTableOfIDs);
- }
+ }
/** ensure element stack capacity */
private void ensureStackCapacity ( int newElementDepth) {
No revision
No revision
1.1.2.13 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/msg/Attic/XMLMessages.properties
Index: XMLMessages.properties
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/msg/Attic/XMLMessages.properties,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -r1.1.2.12 -r1.1.2.13
--- XMLMessages.properties 2000/11/17 00:32:12 1.1.2.12
+++ XMLMessages.properties 2000/11/24 17:39:20 1.1.2.13
@@ -199,8 +199,8 @@
ENTITIESInvalid = Attribute value \"{1}\" of type ENTITIES must be the names of one or more unparsed entities.
ENTITYInvalid = Attribute value \"{1}\" of type ENTITY must be the name of an unparsed entity.
IDDefaultTypeInvalid = The ID attribute \"{0}\" must have a declared default of \"#IMPLIED\" or \"#REQUIRED\".
- IDInvalid = Attribute value \"{1}\" of type ID must be a name.
- IDNotUnique = Attribute value \"{1}\" of type ID must be unique within the document.
+ IDInvalid = Attribute value \"{0}\" of type ID must be a name.
+ IDNotUnique = Attribute value \"{0}\" of type ID must be unique within the document.
IDREFInvalid = Attribute value \"{1}\" of type IDREF must be a name.
IDREFSInvalid = Attribute value \"{0}\" of type IDREFS must be one or more names.
ImproperDeclarationNesting = The replacement text of parameter entity \"{0}\" must include properly nested declarations.
No revision
No revision
1.1.2.4 +10 -2 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/InvalidDatatypeValueException.java
Index: InvalidDatatypeValueException.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/InvalidDatatypeValueException.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- InvalidDatatypeValueException.java 2000/10/12 21:44:01 1.1.2.3
+++ InvalidDatatypeValueException.java 2000/11/24 17:39:20 1.1.2.4
@@ -61,7 +61,7 @@
/**
* @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
- * @version $Id: InvalidDatatypeValueException.java,v 1.1.2.3 2000/10/12 21:44:01 jeffreyr Exp $
+ * @version $Id: InvalidDatatypeValueException.java,v 1.1.2.4 2000/11/24 17:39:20 jeffreyr Exp $
*/
public class InvalidDatatypeValueException
extends SAXException {
@@ -70,7 +70,7 @@
//
private int majorCode = -1;
private int minorCode = -1;
-
+ private String keyIntoReporter;
//
// Constructors
//
@@ -120,11 +120,19 @@
return majorCode;
}
+public String getKeyIntoReporter(){
+ return keyIntoReporter;
+}
+
public void setMinorCode(int code ){
majorCode = code;
}
public void setMajorCode(int code ){
minorCode = code;
+}
+public void setKeyIntoReporter( String key ){
+ keyIntoReporter = key;
+
}
No revision
No revision
1.1.2.9 +7 -4 xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDDatatypeValidator.java
Index: IDDatatypeValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/datatypes/Attic/IDDatatypeValidator.java,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -r1.1.2.8 -r1.1.2.9
--- IDDatatypeValidator.java 2000/11/23 00:11:05 1.1.2.8
+++ IDDatatypeValidator.java 2000/11/24 17:39:21 1.1.2.9
@@ -126,7 +126,7 @@
* </CODE>
*
* @author Jeffrey Rodriguez
- * @version $Id: IDDatatypeValidator.java,v 1.1.2.8 2000/11/23 00:11:05 jeffreyr Exp $
+ * @version $Id: IDDatatypeValidator.java,v 1.1.2.9 2000/11/24 17:39:21 jeffreyr Exp $
* @see org.apache.xerces.impl.validation.datatypes.AbstractDatatypeValidator
* @see org.apache.xerces.impl.validation.DatatypeValidator
* @see org.apache.xerces.impl.validation.datatypes.IDREFDatatypeValidator
@@ -167,14 +167,17 @@
*/
public void validate(String content, Object state ) throws InvalidDatatypeValueException{
- if (!XMLChar.isValidName(content) == true) {//Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
+ boolean status;
+ if ((status = XMLChar.isValidName(content) ) == false) {//Check if is valid key-[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
InvalidDatatypeValueException error = new
- InvalidDatatypeValueException( "ID is not valid: " + content );
+ InvalidDatatypeValueException( content );
+ error.setKeyIntoReporter( "IDInvalid" );
throw error;
}
if (!addId( content)) { //It is OK to pass a null here
InvalidDatatypeValueException error =
- new InvalidDatatypeValueException( "ID '" + content +"' has to be unique" );
+ new InvalidDatatypeValueException( content );
+ error.setKeyIntoReporter( "IDNotUnique" );
throw error;
}
}