// JAXP 1.2 support
if (JAXP_SCHEMA_LANGUAGE.equals(name)) {
// The spec says if a schema is given via SAXParserFactory
// the JAXP 1.2 properties shouldn't be allowed.
if (fSAXParser.grammar != null) {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "schema-already-specified", new Object[] {name}));
}
if ( W3C_XML_SCHEMA.equals(value) ) {
//None of the properties will take effect till the setValidating(true) has been called
if( fSAXParser.isValidating() ) {
fSAXParser.schemaLanguage = W3C_XML_SCHEMA;
setFeature(XMLSCHEMA_VALIDATION_FEATURE, true);
// this will allow the parser not to emit DTD-related
// errors, as the spec demands
if (!fInitProperties.containsKey(JAXP_SCHEMA_LANGUAGE)) {
fInitProperties.put(JAXP_SCHEMA_LANGUAGE, super.getProperty(JAXP_SCHEMA_LANGUAGE));
}
super.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
}
}
else if (value == null) {
fSAXParser.schemaLanguage = null;
setFeature(XMLSCHEMA_VALIDATION_FEATURE, false);
}
else {
// REVISIT: It would be nice if we could format this message
// using a user specified locale as we do in the underlying
// XMLReader -- mrglavas
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "schema-not-supported", null));
}
return;
}
else if (JAXP_SCHEMA_SOURCE.equals(name)) {
// The spec says if a schema is given via SAXParserFactory
// the JAXP 1.2 properties shouldn't be allowed.
if (fSAXParser.grammar != null) {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "schema-already-specified", new Object[] {name}));
}
String val = (String)getProperty(JAXP_SCHEMA_LANGUAGE);
if ( val != null && W3C_XML_SCHEMA.equals(val) ) {
if (!fInitProperties.containsKey(JAXP_SCHEMA_SOURCE)) {
fInitProperties.put(JAXP_SCHEMA_SOURCE, super.getProperty(JAXP_SCHEMA_SOURCE));
}
super.setProperty(name, value);
}
else {
throw new SAXNotSupportedException(
SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
"jaxp-order-not-supported",
new Object[] {JAXP_SCHEMA_LANGUAGE, JAXP_SCHEMA_SOURCE}));
}
return;