Refine search
@Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException { throw new SAXNotRecognizedException(name); }
/** * Configure schema validation as recommended by the JAXP 1.2 spec. * The <code>properties</code> object may contains information about * the schema local and language. * @param properties parser optional info */ private static void configureOldXerces(SAXParser parser, Properties properties) throws ParserConfigurationException, SAXNotSupportedException { String schemaLocation = (String)properties.get("schemaLocation"); String schemaLanguage = (String)properties.get("schemaLanguage"); try{ if (schemaLocation != null) { parser.setProperty(JAXP_SCHEMA_LANGUAGE, schemaLanguage); parser.setProperty(JAXP_SCHEMA_SOURCE, schemaLocation); } } catch (SAXNotRecognizedException e){ log.info(parser.getClass().getName() + ": " + e.getMessage() + " not supported."); } }
mConfig.doSupportExternalEntities(value); } else if (stdFeat == SAXFeature.EXTERNAL_PARAMETER_ENTITIES) { mConfig.doSupportNamespaces(value); } else if (stdFeat == SAXFeature.NAMESPACE_PREFIXES) { mFeatNsPrefixes = value; readOnly = true; } else if (stdFeat == SAXFeature.VALIDATION) { mConfig.doValidateWithDTD(value); } else if (stdFeat == SAXFeature.XMLNS_URIS) { invalidValue = !value; readOnly = true; } else { throw new SAXNotRecognizedException("Feature '"+name+"' not recognized"); throw new SAXNotSupportedException("Feature '"+name+"' is read-only, can not be modified"); throw new SAXNotSupportedException("Trying to set invalid value for feature '"+name+"', '"+value+"'");
/** * This implementation throws a {@code SAXNotRecognizedException} exception * for any feature outside of the "http://xml.org/sax/features/" namespace * and accepts a {@code false} value for any feature within. */ @Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.startsWith("http://xml.org/sax/features/")) { if (value) { throw new SAXNotSupportedException(name); } } else { throw new SAXNotRecognizedException(name); } }
return mConfig.willSupportExternalEntities(); } else if (stdFeat == SAXFeature.EXTERNAL_PARAMETER_ENTITIES) { return mConfig.willSupportExternalEntities(); } else if (stdFeat == SAXFeature.IS_STANDALONE) { return mStandalone; return mConfig.willSupportNamespaces(); } else if (stdFeat == SAXFeature.NAMESPACE_PREFIXES) { return !mConfig.willSupportNamespaces(); throw new SAXNotRecognizedException("Feature '"+name+"' not recognized");
/** create an xml parser, setup to validate using schema, register * appropriate schema locations, and an error handler * @param handler - handler to use * @param schemaLocations * @return */ private static XMLReader createParser(DefaultHandler handler,Map schemaLocations) { String locationString = mkSchemaLocationString(schemaLocations); try { XMLReader reader = XMLReaderFactory.createXMLReader(); reader.setFeature("http://xml.org/sax/features/validation",true); reader.setFeature("http://apache.org/xml/features/validation/schema",true); reader.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",locationString); reader.setErrorHandler(handler); reader.setContentHandler(handler); return reader; } catch (SAXNotRecognizedException e) { fail("required features not rcognized by this xml parser " + e.getMessage()); } catch (SAXNotSupportedException e) { fail("required features not supported by this xml parser " + e.getMessage()); } catch (SAXException e) { fail("cannot create xml reader " + e.getMessage()); } throw new IllegalStateException("Cannot be reached"); } /** collapse the map into a space-separated string, suitable for passing to the parser */
e.printStackTrace(); throw new PhylogenyParserException( "sax not recognized exception: " + e.getMessage() ); e.printStackTrace(); throw new PhylogenyParserException( "sax not supported exception: " + e.getMessage() );
parser.parse(new InputSource(new StringReader(content))); } catch (SAXNotRecognizedException e) { throw new DataServiceException(e, e.toString()); } catch (SAXNotSupportedException e) { throw new DataServiceException(e, e.toString()); } catch (SAXParseException e) { throw new DataServiceException(e, e.toString());
mStaxFactory.getConfig().doSupportExternalEntities(value); } else if (stdFeat == SAXFeature.EXTERNAL_PARAMETER_ENTITIES) { mStaxFactory.getConfig().doSupportNamespaces(value); } else if (stdFeat == SAXFeature.NAMESPACE_PREFIXES) { mFeatNsPrefixes = value; readOnly = true; } else if (stdFeat == SAXFeature.VALIDATION) { mStaxFactory.getConfig().doValidateWithDTD(value); } else if (stdFeat == SAXFeature.XMLNS_URIS) { invalidValue = !value; readOnly = true; } else { throw new SAXNotRecognizedException("Feature '"+name+"' not recognized"); throw new SAXNotSupportedException("Feature '"+name+"' is read-only, can not be modified"); throw new SAXNotSupportedException("Trying to set invalid value for feature '"+name+"', '"+value+"'");
/** * This implementation throws a {@code SAXNotRecognizedException} exception * for any feature outside of the "http://xml.org/sax/features/" namespace * and accepts a {@code false} value for any feature within. */ @Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.startsWith("http://xml.org/sax/features/")) { if (value) { throw new SAXNotSupportedException(name); } } else { throw new SAXNotRecognizedException(name); } }
return mStaxFactory.getConfig().willSupportExternalEntities(); } else if (stdFeat == SAXFeature.EXTERNAL_PARAMETER_ENTITIES) { return mStaxFactory.getConfig().willSupportExternalEntities(); } else if (stdFeat == SAXFeature.IS_STANDALONE) { return mStaxFactory.getConfig().willSupportNamespaces(); } else if (stdFeat == SAXFeature.NAMESPACE_PREFIXES) { return mFeatNsPrefixes; return true; } else { throw new SAXNotRecognizedException("Feature '"+name+"' not recognized");
public void setFeature(String name, boolean value) throws ParserConfigurationException { // If this is the secure processing feature, save it then return. if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { if (System.getSecurityManager() != null && (!value)) { throw new ParserConfigurationException( SAXMessageFormatter.formatMessage(null, "jaxp-secureprocessing-feature", null)); } fSecureProcess = value; return; } if (features == null) { features = new Hashtable(); } features.put(name, value ? Boolean.TRUE : Boolean.FALSE); // Test the feature by possibly throwing SAX exceptions try { new DocumentBuilderImpl(this, attributes, features); } catch (SAXNotSupportedException e) { features.remove(name); throw new ParserConfigurationException(e.getMessage()); } catch (SAXNotRecognizedException e) { features.remove(name); throw new ParserConfigurationException(e.getMessage()); } } }
mConfig.doSupportExternalEntities(value); } else if (stdFeat == SAXFeature.EXTERNAL_PARAMETER_ENTITIES) { mConfig.doSupportNamespaces(value); } else if (stdFeat == SAXFeature.NAMESPACE_PREFIXES) { mFeatNsPrefixes = value; readOnly = true; } else if (stdFeat == SAXFeature.VALIDATION) { mConfig.doValidateWithDTD(value); } else if (stdFeat == SAXFeature.XMLNS_URIS) { invalidValue = !value; readOnly = true; } else { throw new SAXNotRecognizedException("Feature '"+name+"' not recognized"); throw new SAXNotSupportedException("Feature '"+name+"' is read-only, can not be modified"); throw new SAXNotSupportedException("Trying to set invalid value for feature '"+name+"', '"+value+"'");
@Override public boolean getFeature(String name) throws SAXNotRecognizedException { throw new SAXNotRecognizedException(name); }
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException("name == null"); } if (name.equals(LEXICAL_HANDLER_PROPERTY)) { // The object must implement LexicalHandler if (value instanceof LexicalHandler || value == null) { this.lexicalHandler = (LexicalHandler) value; return; } throw new SAXNotSupportedException("value doesn't implement " + "org.xml.sax.ext.LexicalHandler"); } throw new SAXNotRecognizedException(name); }
return mConfig.willSupportExternalEntities(); } else if (stdFeat == SAXFeature.EXTERNAL_PARAMETER_ENTITIES) { return mConfig.willSupportExternalEntities(); } else if (stdFeat == SAXFeature.IS_STANDALONE) { return mStandalone; return mConfig.willSupportNamespaces(); } else if (stdFeat == SAXFeature.NAMESPACE_PREFIXES) { return !mConfig.willSupportNamespaces(); throw new SAXNotRecognizedException("Feature '"+name+"' not recognized");
/** * Create a <code>SAXParser</code> configured to support XML Scheman and DTD * @param properties parser specific properties/features * @return an XML Schema/DTD enabled <code>SAXParser</code> */ public static SAXParser newSAXParser(Properties properties) throws ParserConfigurationException, SAXException, SAXNotRecognizedException{ SAXParserFactory factory = (SAXParserFactory)properties.get("SAXParserFactory"); SAXParser parser = factory.newSAXParser(); String schemaLocation = (String)properties.get("schemaLocation"); String schemaLanguage = (String)properties.get("schemaLanguage"); try{ if (schemaLocation != null) { parser.setProperty(JAXP_SCHEMA_LANGUAGE, schemaLanguage); parser.setProperty(JAXP_SCHEMA_SOURCE, schemaLocation); } } catch (SAXNotRecognizedException e){ log.info(parser.getClass().getName() + ": " + e.getMessage() + " not supported."); } return parser; }
public void setFeature(String name, boolean value) throws ParserConfigurationException { // If this is the secure processing feature, save it then return. if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { if (System.getSecurityManager() != null && (!value)) { throw new ParserConfigurationException( SAXMessageFormatter.formatMessage(null, "jaxp-secureprocessing-feature", null)); } fSecureProcess = value; return; } if (features == null) { features = new Hashtable(); } features.put(name, value ? Boolean.TRUE : Boolean.FALSE); // Test the feature by possibly throwing SAX exceptions try { new DocumentBuilderImpl(this, attributes, features); } catch (SAXNotSupportedException e) { features.remove(name); throw new ParserConfigurationException(e.getMessage()); } catch (SAXNotRecognizedException e) { features.remove(name); throw new ParserConfigurationException(e.getMessage()); } } }