You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by sa...@apache.org on 2002/01/15 23:22:18 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/xs/traversers XSDAbstractIDConstraintTraverser.java XSDAbstractTraverser.java XSDAttributeGroupTraverser.java XSDAttributeTraverser.java XSDGroupTraverser.java XSDHandler.java
sandygao 02/01/15 14:22:18
Modified: java/src/org/apache/xerces/impl/msg
XMLSchemaMessages.properties
java/src/org/apache/xerces/impl/xs XMLSchemaValidator.java
java/src/org/apache/xerces/impl/xs/traversers
XSDAbstractIDConstraintTraverser.java
XSDAbstractTraverser.java
XSDAttributeGroupTraverser.java
XSDAttributeTraverser.java XSDGroupTraverser.java
XSDHandler.java
Log:
Cleanup all reportGenericSchemaError() method calls.
Revision Changes Path
1.38 +10 -6 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.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- XMLSchemaMessages.properties 15 Jan 2002 21:07:55 -0000 1.37
+++ XMLSchemaMessages.properties 15 Jan 2002 22:22:18 -0000 1.38
@@ -62,7 +62,6 @@
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.
- SchemaLocation = Value \"{0}\" is not valid 'schemaLocation' syntax. anyURI must be followed by schema file.
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}''.
@@ -159,7 +158,7 @@
#schema valid (3.X.3)
sch-props-correct = Duplicate declaration for an element ''{0}''
- schema_reference = schema_reference: error.
+ schema_reference.4 = schema_reference.4: Failed to read schema document ''{0}''.
src-annotation = src-annotation: can only contain <appinfo> and <documentation> elements.
src-attribute.1 = src-attribute.1: ''default'' and ''fixed'' must not both be present in attribute declaration ''{0}''.
src-attribute.2 = src-attribute.2: : ''default'' is present in attribute ''{0}'', so ''use'' must be ''optional''.
@@ -180,7 +179,9 @@
src-element.4 = src-element.4: error.
src-expredef = src-expredef: error.
src-identity-constraint.1 = src-identity-constraint.1: a ''<selector>'' or a ''<field>'' element can contain at most one ''<annotation>'' in its content; identity constraint ''{0}'' violates this constraint.
+ src-import.0 = src-import.0: Failed to read imported schema document ''{0}''.
src-import.1.1 = src-import.1.1: The namespace attribute ''{0}'' of an <import> element information item must not be the same as the targetNamespace of the schema it exists in.
+ src-include.0 = src-include.0: Failed to read included schema document ''{0}''.
src-include.2 = src-include.2: the targetNamespace of the schema ''{0}'' must be identical to that of the including or redefining schema (''{1}'').
src-list-itemType-or-simpleType = src-list-itemType-or-simpleType: error.
src-model_group = src-model_group: error.
@@ -189,6 +190,7 @@
src-multiple-patterns = src-multiple-patterns: error.
src-notation = src-notation: {0}.
src-qname = src-qname: error.
+ src-redefine.0 = src-redefine.0: Failed to read redefined schema document ''{0}''.
src-redefine.1 = src-redefine.1: the component ''{0}'' occurs in a schema different from that which was redefined.
src-redefine.5 = src-redefine.5: <simpleType> or <complexType> children of <redefine> elements must have <extension> or <restriction> descendants referring to themselves.
src-redefine = src-redefine: A <redefine> element cannot contain a child of type ''{0}''.
@@ -217,7 +219,7 @@
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: error.
+ c-fields-xpaths = c-fields-xpaths: The field value = ''{0}'' is not a valid: {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.
@@ -248,7 +250,7 @@
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: error.
+ 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.
@@ -347,12 +349,14 @@
w-props-correct = w-props-correct: error.
# codes not defined by the spec
- ValidationRoot = Validation Root Valid (ID/IDREF) (�3.3.4): validation was not successful.
+
+ 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 = Pattern value ''{0}'' is not a valid regular expression: ''{1}''.
- FacetValueFromBase = Value ''{0}'' of facet ''{1}'' must from the value space of the base type.
+ SchemaLocation = schemaLocation value = ''{0}'' must have even number of URI''s.
UndeclaredPrefix = Cannot resolve ''{0}'' as a QName: the prefix ''{1}'' is not declared.
UndeclaredEntity = Entity ''{0}'' is not declared.
+ ValidationRoot = Validation Root Valid (ID/IDREF) (�3.3.4): validation was not successful.
# SimpleTypes
ListUnionRestrictionError = List | Union | Restriction content is invalid for type ''{0}''
1.29 +3 -3 xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
Index: XMLSchemaValidator.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- XMLSchemaValidator.java 10 Jan 2002 17:17:52 -0000 1.28
+++ XMLSchemaValidator.java 15 Jan 2002 22:22:18 -0000 1.29
@@ -126,7 +126,7 @@
* @author Elena Litani IBM
* @author Andy Clark IBM
* @author Neeraj Bajaj, Sun Microsystems, inc.
- * @version $Id: XMLSchemaValidator.java,v 1.28 2002/01/10 17:17:52 sandygao Exp $
+ * @version $Id: XMLSchemaValidator.java,v 1.29 2002/01/15 22:22:18 sandygao Exp $
*/
public class XMLSchemaValidator
implements XMLComponent, XMLDocumentFilter, FieldActivator {
@@ -1705,9 +1705,9 @@
while (t.hasMoreTokens()) {
namespace = t.nextToken ();
if (!t.hasMoreTokens()) {
- // REVISIT: new error code
fXSIErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
- "General", new Object[]{"No matching location hint for namespace '" + namespace + "' in attribute schemaLocation"},
+ "SchemaLocation",
+ new Object[]{sLocation},
XMLErrorReporter.SEVERITY_WARNING);
break;
}
1.2 +9 -16 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSDAbstractIDConstraintTraverser.java 25 Oct 2001 20:36:04 -0000 1.1
+++ XSDAbstractIDConstraintTraverser.java 15 Jan 2002 22:22:18 -0000 1.2
@@ -72,7 +72,7 @@
* traversers (the XSDUniqueTraverser, XSDKeyTraverser and
* XSDKeyrefTraverser) rely upon.
*
- * @version $Id: XSDAbstractIDConstraintTraverser.java,v 1.1 2001/10/25 20:36:04 elena Exp $
+ * @version $Id: XSDAbstractIDConstraintTraverser.java,v 1.2 2002/01/15 22:22:18 sandygao Exp $
*/
class XSDAbstractIDConstraintTraverser extends XSDAbstractTraverser {
@@ -89,8 +89,7 @@
// check for <annotation> and get selector
Element sElem = DOMUtil.getFirstChildElement(icElem);
if(sElem == null) {
- // REVISIT: localize
- reportGenericSchemaError("The content of an identity constraint must match (annotation?, selector, field+)");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"identity constraint", "(annotation?, selector, field+)"});
return;
}
@@ -102,16 +101,14 @@
}
// if no more children report an error
if(sElem == null) {
- // REVISIT: localize
- reportGenericSchemaError("The content of an identity constraint must match (annotation?, selector, field+)");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"identity constraint", "(annotation?, selector, field+)"});
return;
}
Object [] attrValues = fAttrChecker.checkAttributes(sElem, false, schemaDoc);
// if more than one annotation report an error
if(!DOMUtil.getLocalName(sElem).equals(SchemaSymbols.ELT_SELECTOR)) {
- // REVISIT: localize
- reportGenericSchemaError("The content of an identity constraint must match (annotation?, selector, field+)");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"identity constraint", "(annotation?, selector, field+)"});
}
// and make sure <selector>'s content is fine:
Element selChild = DOMUtil.getFirstChildElement(sElem);
@@ -123,7 +120,7 @@
selChild = DOMUtil.getNextSiblingElement(selChild);
}
else {
- reportGenericSchemaError("The content of an identity constraint must match (annotation?, selector, field+)");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"identity constraint", "(annotation?, selector, field+)"});
}
if (selChild != null) {
reportSchemaError("src-identity-constraint.1", new Object [] {icElemAttrs[XSAttributeChecker.ATTIDX_NAME]});
@@ -145,8 +142,7 @@
ic.setSelector(selector);
}
catch (XPathException e) {
- // REVISIT: Add error message.
- reportGenericSchemaError(e.getMessage());
+ reportSchemaError("c-selector-xpath", new Object[]{sText, e.getLocalizedMessage()});
// put back attr values...
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return;
@@ -158,16 +154,14 @@
// get fields
Element fElem = DOMUtil.getNextSiblingElement(sElem);
if(fElem == null) {
- // REVISIT: localize
- reportGenericSchemaError("The content of an identity constraint must match (annotation?, selector, field+)");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"identity constraint", "(annotation?, selector, field+)"});
}
while (fElem != null) {
// General Attribute Checking
attrValues = fAttrChecker.checkAttributes(fElem, false, schemaDoc);
if(!DOMUtil.getLocalName(fElem).equals(SchemaSymbols.ELT_FIELD))
- // REVISIT: localize
- reportGenericSchemaError("The content of an identity constraint must match (annotation?, selector, field+)");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"identity constraint", "(annotation?, selector, field+)"});
// and make sure <field>'s content is fine:
Element fieldChild = DOMUtil.getFirstChildElement(fElem);
@@ -194,8 +188,7 @@
ic.addField(field);
}
catch (XPathException e) {
- // REVISIT: Add error message.
- reportGenericSchemaError(e.getMessage());
+ reportSchemaError("c-fields-xpaths", new Object[]{fText, e.getLocalizedMessage()});
// put back attr values...
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return;
1.8 +1 -9 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Index: XSDAbstractTraverser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XSDAbstractTraverser.java 15 Jan 2002 21:07:55 -0000 1.7
+++ XSDAbstractTraverser.java 15 Jan 2002 22:22:18 -0000 1.8
@@ -93,7 +93,7 @@
* @author Rahul Srivastava, Sun Microsystems Inc.
* @author Neeraj Bajaj, Sun Microsystems Inc.
*
- * @version $Id: XSDAbstractTraverser.java,v 1.7 2002/01/15 21:07:55 sandygao Exp $
+ * @version $Id: XSDAbstractTraverser.java,v 1.8 2002/01/15 22:22:18 sandygao Exp $
*/
abstract class XSDAbstractTraverser {
@@ -503,14 +503,6 @@
void reportSchemaError (String key, Object[] args) {
fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
key, args,
- XMLErrorReporter.SEVERITY_ERROR);
- }
-
- // REVISIT: is it how we want to handle error reporting?
- void reportGenericSchemaError (String error) {
- fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
- "General",
- new Object[]{error},
XMLErrorReporter.SEVERITY_ERROR);
}
1.3 +3 -3 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java
Index: XSDAttributeGroupTraverser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAttributeGroupTraverser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSDAttributeGroupTraverser.java 31 Oct 2001 21:47:20 -0000 1.2
+++ XSDAttributeGroupTraverser.java 15 Jan 2002 22:22:18 -0000 1.3
@@ -78,7 +78,7 @@
* @author Rahul Srivastava, Sun Microsystems Inc.
* @author Sandy Gao, IBM
*
- * @version $Id: XSDAttributeGroupTraverser.java,v 1.2 2001/10/31 21:47:20 neilg Exp $
+ * @version $Id: XSDAttributeGroupTraverser.java,v 1.3 2002/01/15 22:22:18 sandygao Exp $
*/
class XSDAttributeGroupTraverser extends XSDAbstractTraverser {
@@ -103,7 +103,7 @@
// ref should be here.
if (refAttr == null) {
- reportGenericSchemaError("Local attributeGroup declaration should have ref.");
+ reportSchemaError("s4s-att-must-appear", new Object[]{"attributeGroup (local)", "ref"});
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
return null;
}
@@ -145,7 +145,7 @@
// global declaration must have a name
if (nameAttr == null) {
- reportGenericSchemaError("Global attributeGroup declaration must have a name.");
+ reportSchemaError("s4s-att-must-appear", new Object[]{"attributeGroup (global)", "name"});
nameAttr = "no name";
}
1.8 +2 -3 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java
Index: XSDAttributeTraverser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDAttributeTraverser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XSDAttributeTraverser.java 14 Dec 2001 20:04:16 -0000 1.7
+++ XSDAttributeTraverser.java 15 Jan 2002 22:22:18 -0000 1.8
@@ -94,7 +94,7 @@
*
* @author Sandy Gao, IBM
* @author Neeraj Bajaj, Sun Microsystems, inc.
- * @version $Id: XSDAttributeTraverser.java,v 1.7 2001/12/14 20:04:16 sandygao Exp $
+ * @version $Id: XSDAttributeTraverser.java,v 1.8 2002/01/15 22:22:18 sandygao Exp $
*/
class XSDAttributeTraverser extends XSDAbstractTraverser {
@@ -310,8 +310,7 @@
if (type != null && type.getXSType() == XSTypeDecl.SIMPLE_TYPE)
attrType = (XSSimpleType)type;
else
- // REVISIT: what should be the error code here
- reportGenericSchemaError("the type for attribute '"+nameAtt+"' must be a simpleType");
+ reportSchemaError("src-resolve", new Object[]{typeAtt.rawname, "simpleType definition"});
}
if (attrType == null) {
1.3 +6 -6 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java
Index: XSDGroupTraverser.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDGroupTraverser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSDGroupTraverser.java 7 Jan 2002 19:03:17 -0000 1.2
+++ XSDGroupTraverser.java 15 Jan 2002 22:22:18 -0000 1.3
@@ -78,7 +78,7 @@
* @author Rahul Srivastava, Sun Microsystems Inc.
* @author Elena Litani, IBM
* @author Lisa Martin, IBM
- * @version $Id: XSDGroupTraverser.java,v 1.2 2002/01/07 19:03:17 neilg Exp $
+ * @version $Id: XSDGroupTraverser.java,v 1.3 2002/01/15 22:22:18 sandygao Exp $
*/
class XSDGroupTraverser extends XSDAbstractParticleTraverser {
@@ -103,7 +103,7 @@
// ref should be here.
if (refAttr == null) {
- reportGenericSchemaError("Local group declaration should have ref.");
+ reportSchemaError("s4s-att-must-appear", new Object[]{"group (local)", "ref"});
} else {
// get global decl
// index is a particle index.
@@ -112,7 +112,7 @@
// no children are allowed
if (DOMUtil.getFirstChildElement(elmNode) != null) {
- reportGenericSchemaError("Local group declaration cannot have a child.");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"group (local)", "(annotation?)"});
}
int minOccurs = minAttr.intValue();
@@ -154,7 +154,7 @@
// must have a name
if (strNameAttr == null) {
- reportGenericSchemaError("Global group declaration must have a name.");
+ reportSchemaError("s4s-att-must-appear", new Object[]{"group (global)", "name"});
}
XSGroupDecl group = null;
@@ -163,7 +163,7 @@
// must have at least one child
Element l_elmChild = DOMUtil.getFirstChildElement(elmNode);
if (l_elmChild == null) {
- reportGenericSchemaError("Global group declaration must have a child.");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"});
} else {
String childName = l_elmChild.getLocalName();
if (childName.equals(SchemaSymbols.ELT_ANNOTATION)) {
@@ -174,7 +174,7 @@
}
if (l_elmChild == null) {
- reportGenericSchemaError("Global group element must have a child <all>, <choice> or <sequence>.");
+ reportSchemaError("s4s-elt-must-match", new Object[]{"group (global)", "(annotation?, (all | choice | sequence))"});
} else if (childName.equals(SchemaSymbols.ELT_ALL)) {
particle = traverseAll(l_elmChild, schemaDoc, grammar, CHILD_OF_GROUP);
} else if (childName.equals(SchemaSymbols.ELT_CHOICE)) {
1.13 +19 -20 xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
Index: XSDHandler.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XSDHandler.java 14 Jan 2002 19:44:55 -0000 1.12
+++ XSDHandler.java 15 Jan 2002 22:22:18 -0000 1.13
@@ -97,7 +97,7 @@
* schema, other grammars may be constructed as a side-effect.
*
* @author Neil Graham, IBM
- * @version $Id: XSDHandler.java,v 1.12 2002/01/14 19:44:55 neilg Exp $
+ * @version $Id: XSDHandler.java,v 1.13 2002/01/15 22:22:18 sandygao Exp $
*/
public class XSDHandler {
@@ -344,7 +344,7 @@
String schemaHint) {
// first phase: construct trees.
- Document schemaRoot = getSchema(schemaNamespace, schemaHint, null, true, true);
+ Document schemaRoot = getSchema(schemaNamespace, schemaHint, null, true, INSTANCE);
if (schemaRoot == null) {
// something went wrong right off the hop
return null;
@@ -441,7 +441,7 @@
fAttributeChecker.returnAttrArray(includeAttrs, currSchemaInfo);
// consciously throw away whether was a duplicate; don't care.
// pass the systemId of the current document as the base systemId
- newSchemaRoot = getSchema(schemaNamespace, schemaHint, (String)fDoc2SystemId.get(schemaRoot), false, true);
+ newSchemaRoot = getSchema(schemaNamespace, schemaHint, (String)fDoc2SystemId.get(schemaRoot), false, IMPORT);
}
else if ((localName.equals(SchemaSymbols.ELT_INCLUDE)) ||
(localName.equals(SchemaSymbols.ELT_REDEFINE))) {
@@ -457,10 +457,12 @@
"<include> or <redefine>", "schemaLocation"});
// pass the systemId of the current document as the base systemId
boolean mustResolve = false;
+ short referType = INCLUDE;
if(localName.equals(SchemaSymbols.ELT_REDEFINE)) {
mustResolve = nonAnnotationContent(child);
+ referType = REDEFINE;
}
- newSchemaRoot = getSchema(null, schemaHint, (String)fDoc2SystemId.get(schemaRoot), mustResolve, false);
+ newSchemaRoot = getSchema(null, schemaHint, (String)fDoc2SystemId.get(schemaRoot), mustResolve, referType);
schemaNamespace = currSchemaInfo.fTargetNamespace;
}
else {
@@ -1009,6 +1011,14 @@
fKeyrefNamespaceContext[fKeyrefStackPos++] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
} // storeKeyref (Element, XSDocumentInfo, XSElementDecl): void
+ // all possible ways of referring to a schema document
+ private static short INSTANCE = 0;
+ private static short IMPORT = 1;
+ private static short INCLUDE = 2;
+ private static short REDEFINE = 3;
+ private static String[] ERROR_CODES = {"schema_reference.4", "src-import.0",
+ "src-include.0", "src-redefine.0"};
+
// This method is responsible for schema resolution. If it finds
// a schema document that the XMLEntityResolver resolves to with
// the given namespace and hint, it returns it. It returns true
@@ -1016,12 +1026,13 @@
// otherwise. schemaDoc is null if and only if no schema document
// was resolved to.
private Document getSchema(String schemaNamespace, String schemaHint,
- String baseSystemId, boolean mustResolve, boolean useProperties) {
+ String baseSystemId, boolean mustResolve, short referType) {
// contents of this method will depend on the system we adopt for entity resolution--i.e., XMLEntityHandler, EntityHandler, etc.
XMLInputSource schemaSource=null;
Document schemaDoc = null;
try {
- schemaSource = fLocationResolver.resolveEntity(schemaNamespace, schemaHint, baseSystemId, useProperties);
+ schemaSource = fLocationResolver.resolveEntity(schemaNamespace, schemaHint, baseSystemId,
+ referType == INSTANCE || referType == IMPORT);
// REVISIT: when the system id and byte stream and character stream
// of the input source are all null, it's
// impossible to find the schema document. so we skip in
@@ -1060,22 +1071,10 @@
}
}
- catch (java.io.FileNotFoundException ex) {
- fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
- "General",
- new Object[]{"file not found: " + schemaHint},
- // when using namespace, then hint is optional,
- // and it's not an error if the file is not found
- // but if not using namespace (include),
- // it's a warning if the file is not found.
- mustResolve ?
- XMLErrorReporter.SEVERITY_ERROR:
- XMLErrorReporter.SEVERITY_WARNING);
- }
catch (IOException ex) {
fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
- "General",
- new Object[]{"Error encountered reading schema document " + schemaHint},
+ ERROR_CODES[referType],
+ new Object[]{schemaHint},
// when using namespace, then hint is optional,
// and it's not an error if the file is not found
// but if not using namespace (include),
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org