org.xml.sax.SAXNotSupportedException Java Examples
The following examples show how to use
org.xml.sax.SAXNotSupportedException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SAXParserImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
private void setSchemaValidatorProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { try { fSAXParser.fSchemaValidator.setProperty(name, value); } // This should never be thrown from the schema validator. catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "property-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "property-not-supported", new Object [] {identifier})); } } }
Example #2
Source File: AbstractStaxXMLReader.java From spring-analysis-note with MIT License | 6 votes |
@Override public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (NAMESPACES_FEATURE_NAME.equals(name)) { return this.namespacesFeature; } else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) { return this.namespacePrefixesFeature; } else if (IS_STANDALONE_FEATURE_NAME.equals(name)) { if (this.isStandalone != null) { return this.isStandalone; } else { throw new SAXNotSupportedException("startDocument() callback not completed yet"); } } else { return super.getFeature(name); } }
Example #3
Source File: ValidatorHandlerImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } try { fComponentManager.setProperty(name, object); } catch (XMLConfigurationException e) { final String identifier = e.getIdentifier(); final String key = e.getType() == Status.NOT_RECOGNIZED ? "property-not-recognized" : "property-not-supported"; throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), key, new Object [] {identifier})); } }
Example #4
Source File: SAXBufferProcessor.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(Features.NAMESPACES_FEATURE)) { return true; } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) { return _namespacePrefixesFeature; } else if (name.equals(Features.EXTERNAL_GENERAL_ENTITIES)) { return true; } else if (name.equals(Features.EXTERNAL_PARAMETER_ENTITIES)) { return true; } else if (name.equals(Features.STRING_INTERNING_FEATURE)) { return _stringInterningFeature; } else { throw new SAXNotRecognizedException( "Feature not supported: " + name); } }
Example #5
Source File: ValidatorImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } try { fComponentManager.setProperty(name, object); } catch (XMLConfigurationException e) { final String identifier = e.getIdentifier(); final String key = e.getType() == Status.NOT_RECOGNIZED ? "property-not-recognized" : "property-not-supported"; throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), key, new Object [] {identifier})); } fConfigurationChanged = true; }
Example #6
Source File: SAXParserImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public synchronized Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { // TODO: Add localized error message. throw new NullPointerException(); } if (fSAXParser != null && JAXP_SCHEMA_LANGUAGE.equals(name)) { // JAXP 1.2 support return fSAXParser.schemaLanguage; } /** Check to see if the property is managed by the security manager **/ String propertyValue = (fSecurityManager != null) ? fSecurityManager.getLimitAsString(name) : null; if (propertyValue != null) { return propertyValue; } else { propertyValue = (fSecurityPropertyMgr != null) ? fSecurityPropertyMgr.getValue(name) : null; if (propertyValue != null) { return propertyValue; } } return super.getProperty(name); }
Example #7
Source File: SAXParserImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void setSchemaValidatorProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { try { fSAXParser.fSchemaValidator.setProperty(name, value); } // This should never be thrown from the schema validator. catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "property-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "property-not-supported", new Object [] {identifier})); } } }
Example #8
Source File: SAXDocumentParser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(Features.NAMESPACES_FEATURE)) { if (value == false) { throw new SAXNotSupportedException(name + ":" + value); } } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) { _namespacePrefixesFeature = value; } else if (name.equals(Features.STRING_INTERNING_FEATURE) || name.equals(FastInfosetReader.STRING_INTERNING_PROPERTY)) { setStringInterning(value); } else { throw new SAXNotRecognizedException( CommonResourceBundle.getInstance().getString("message.featureNotSupported") + name); } }
Example #9
Source File: ExsltDynamic.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * The dyn:evaluate function evaluates a string as an XPath expression and returns * the resulting value, which might be a boolean, number, string, node set, result * tree fragment or external object. The sole argument is the string to be evaluated. * <p> * If the expression string passed as the second argument is an invalid XPath * expression (including an empty string), this function returns an empty node set. * <p> * You should only use this function if the expression must be constructed dynamically, * otherwise it is much more efficient to use the expression literally. * * @param myContext The ExpressionContext passed by the extension processor * @param xpathExpr The XPath expression string * * @return The evaluation result */ public static XObject evaluate(ExpressionContext myContext, String xpathExpr) throws SAXNotSupportedException { if (myContext instanceof XPathContext.XPathExpressionContext) { XPathContext xctxt = null; try { xctxt = ((XPathContext.XPathExpressionContext) myContext).getXPathContext(); XPath dynamicXPath = new XPath(xpathExpr, xctxt.getSAXLocator(), xctxt.getNamespaceContext(), XPath.SELECT); return dynamicXPath.execute(xctxt, myContext.getContextNode(), xctxt.getNamespaceContext()); } catch (TransformerException e) { return new XNodeSet(xctxt.getDTMManager()); } } else throw new SAXNotSupportedException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_CONTEXT_PASSED, new Object[]{myContext })); //"Invalid context passed to evaluate " }
Example #10
Source File: DOMParser.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public void setProperty0(String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { try { fConfiguration.setProperty(propertyId, value); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "property-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "property-not-supported", new Object [] {identifier})); } } }
Example #11
Source File: ValidatorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } try { return fComponentManager.getFeature(name); } catch (XMLConfigurationException e) { final String identifier = e.getIdentifier(); final String key = e.getType() == Status.NOT_RECOGNIZED ? "feature-not-recognized" : "feature-not-supported"; throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), key, new Object [] {identifier})); } }
Example #12
Source File: ValidatorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } //Support current-element-node; return current node if DOMSource is used. if (CURRENT_ELEMENT_NODE.equals(name)) { return (fDOMValidatorHelper != null) ? fDOMValidatorHelper.getCurrentElement() : null; } try { return fComponentManager.getProperty(name); } catch (XMLConfigurationException e) { final String identifier = e.getIdentifier(); final String key = e.getType() == Status.NOT_RECOGNIZED ? "property-not-recognized" : "property-not-supported"; throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), key, new Object [] {identifier})); } }
Example #13
Source File: ValidatorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public void setProperty(String name, Object object) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } try { fComponentManager.setProperty(name, object); } catch (XMLConfigurationException e) { final String identifier = e.getIdentifier(); final String key = e.getType() == Status.NOT_RECOGNIZED ? "property-not-recognized" : "property-not-supported"; throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), key, new Object [] {identifier})); } fConfigurationChanged = true; }
Example #14
Source File: XMLSchemaFactory.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "FeatureNameNull", null)); } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return (fSecurityManager != null && fSecurityManager.isSecureProcessing()); } try { return fXMLSchemaLoader.getFeature(name); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-supported", new Object [] {identifier})); } } }
Example #15
Source File: ValidatorHandlerImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } try { return fComponentManager.getFeature(name); } catch (XMLConfigurationException e) { final String identifier = e.getIdentifier(); final String key = e.getType() == Status.NOT_RECOGNIZED ? "feature-not-recognized" : "feature-not-supported"; throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), key, new Object [] {identifier})); } }
Example #16
Source File: XMLSchemaFactory.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "FeatureNameNull", null)); } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return (fSecurityManager != null && fSecurityManager.isSecureProcessing()); } try { return fXMLSchemaLoader.getFeature(name); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "feature-not-supported", new Object [] {identifier})); } } }
Example #17
Source File: ValidatorImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } try { fComponentManager.setFeature(name, value); } catch (XMLConfigurationException e) { final String identifier = e.getIdentifier(); final String key; if (e.getType() == Status.NOT_ALLOWED) { //for now, the identifier can only be (XMLConstants.FEATURE_SECURE_PROCESSING) throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), "jaxp-secureprocessing-feature", null)); } else if (e.getType() == Status.NOT_RECOGNIZED) { key = "feature-not-recognized"; } else { key = "feature-not-supported"; } throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fComponentManager.getLocale(), key, new Object [] {identifier})); } fConfigurationChanged = true; }
Example #18
Source File: CLDRConverter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Configure the parser to allow access to DTDs on the file system. */ private static void enableFileAccess(SAXParser parser) throws SAXNotSupportedException { try { parser.setProperty("http://javax.xml.XMLConstants/property/accessExternalDTD", "file"); } catch (SAXNotRecognizedException ignore) { // property requires >= JAXP 1.5 } }
Example #19
Source File: AbstractXMLReader.java From spring-analysis-note with MIT License | 5 votes |
/** * 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); } }
Example #20
Source File: AbstractXMLReader.java From java-technology-stack with MIT License | 5 votes |
/** * This implementation throws a {@code SAXNotRecognizedException} exception * for any feature outside of the "http://xml.org/sax/features/" namespace * and returns {@code false} for any feature within. */ @Override public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.startsWith("http://xml.org/sax/features/")) { return false; } else { throw new SAXNotRecognizedException(name); } }
Example #21
Source File: DocumentBuilderImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private void setFeatures( Map<String, Boolean> features) throws SAXNotSupportedException, SAXNotRecognizedException { if (features != null) { for (Map.Entry<String, Boolean> entry : features.entrySet()) { domParser.setFeature(entry.getKey(), entry.getValue()); } } }
Example #22
Source File: AbstractXMLReader.java From spring-analysis-note with MIT License | 5 votes |
/** * Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical * handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}. */ @Override @Nullable public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if ("http://xml.org/sax/properties/lexical-handler".equals(name)) { return this.lexicalHandler; } else { throw new SAXNotRecognizedException(name); } }
Example #23
Source File: AbstractXMLReader.java From spring-analysis-note with MIT License | 5 votes |
/** * Throws a {@code SAXNotRecognizedException} exception when the given property does not signify a lexical * handler. The property name for a lexical handler is {@code http://xml.org/sax/properties/lexical-handler}. */ @Override public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if ("http://xml.org/sax/properties/lexical-handler".equals(name)) { this.lexicalHandler = (LexicalHandler) value; } else { throw new SAXNotRecognizedException(name); } }
Example #24
Source File: TestSAXDriver.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public synchronized void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(name)) { throw new SAXNotRecognizedException(name+" feature is not recognised by test SAX parser intentionally."); } else { super.setFeature(name, value); } }
Example #25
Source File: SAXBufferProcessor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(Properties.LEXICAL_HANDLER_PROPERTY)) { if (value instanceof LexicalHandler) { setLexicalHandler((LexicalHandler)value); } else { throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); } } else { throw new SAXNotRecognizedException("Property not recognized: " + name); } }
Example #26
Source File: DOMParser.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Set the state of any feature in a SAX2 parser. The parser * might not recognize the feature, and if it does recognize * it, it might not be able to fulfill the request. * * @param featureId The unique identifier (URI) of the feature. * @param state The requested state of the feature (true or false). * * @exception SAXNotRecognizedException If the * requested feature is not known. * @exception SAXNotSupportedException If the * requested feature is known, but the requested * state is not supported. */ public void setFeature(String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException { try { // http://xml.org/sax/features/use-entity-resolver2 // controls whether the methods of an object implementing // org.xml.sax.ext.EntityResolver2 will be used by the parser. // if (featureId.equals(USE_ENTITY_RESOLVER2)) { if (state != fUseEntityResolver2) { fUseEntityResolver2 = state; // Refresh EntityResolver wrapper. setEntityResolver(getEntityResolver()); } return; } // // Default handling // fConfiguration.setFeature(featureId, state); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "feature-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "feature-not-supported", new Object [] {identifier})); } } }
Example #27
Source File: JdkXmlUtils.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets the XMLReader instance with the specified property if the the * property is supported, ignores error if not, issues a warning if so * requested. * * @param reader an XMLReader instance * @param property the name of the property * @param value the value of the property * @param warn a flag indicating whether a warning should be issued */ public static void setXMLReaderPropertyIfSupport(XMLReader reader, String property, Object value, boolean warn) { try { reader.setProperty(property, value); } catch (SAXNotRecognizedException | SAXNotSupportedException e) { if (warn) { XMLSecurityManager.printWarning(reader.getClass().getName(), property, e); } } }
Example #28
Source File: AbstractStaxXMLReader.java From spring-analysis-note with MIT License | 5 votes |
@Override public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException { if (NAMESPACES_FEATURE_NAME.equals(name)) { this.namespacesFeature = value; } else if (NAMESPACE_PREFIXES_FEATURE_NAME.equals(name)) { this.namespacePrefixesFeature = value; } else { super.setFeature(name, value); } }
Example #29
Source File: DOMParser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Query the state of a feature. * * Query the current state of any feature in a SAX2 parser. The * parser might not recognize the feature. * * @param featureId The unique identifier (URI) of the feature * being set. * @return The current state of the feature. * @exception org.xml.sax.SAXNotRecognizedException If the * requested feature is not known. * @exception SAXNotSupportedException If the * requested feature is known but not supported. */ public boolean getFeature(String featureId) throws SAXNotRecognizedException, SAXNotSupportedException { try { // http://xml.org/sax/features/use-entity-resolver2 // controls whether the methods of an object implementing // org.xml.sax.ext.EntityResolver2 will be used by the parser. // if (featureId.equals(USE_ENTITY_RESOLVER2)) { return fUseEntityResolver2; } // // Default handling // return fConfiguration.getFeature(featureId); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "feature-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), "feature-not-supported", new Object [] {identifier})); } } }
Example #30
Source File: TestSAXDriver.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Override public synchronized void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException { if (XMLConstants.ACCESS_EXTERNAL_DTD.equals(name) || ENT_EXP_LIMIT_PROP.equals(name)) { throw new SAXNotRecognizedException(name+" property is not recognised by test SAX parser intentionally."); } else { super.setProperty(name, value); } }