org.xml.sax.SAXNotRecognizedException Java Examples
The following examples show how to use
org.xml.sax.SAXNotRecognizedException.
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: 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 #2
Source File: DOMParser.java From TencentKona-8 with GNU General Public License v2.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 #3
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 #4
Source File: SAXBufferProcessor.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) { throw new SAXNotSupportedException(name + ":" + value); } } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) { _namespacePrefixesFeature = value; } else if (name.equals(Features.EXTERNAL_GENERAL_ENTITIES)) { // ignore } else if (name.equals(Features.EXTERNAL_PARAMETER_ENTITIES)) { // ignore } else if (name.equals(Features.STRING_INTERNING_FEATURE)) { if (value != _stringInterningFeature) { throw new SAXNotSupportedException(name + ":" + value); } } else { throw new SAXNotRecognizedException( "Feature not supported: " + name); } }
Example #5
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 #6
Source File: ValidatorImpl.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(); } 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 #7
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 #8
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 #9
Source File: AbstractStaxXMLReader.java From java-technology-stack 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 #10
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 #11
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 #12
Source File: ValidatorHandlerImpl.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(); } 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 #13
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 #14
Source File: HtmlUtils.java From openemm with GNU Affero General Public License v3.0 | 6 votes |
/** * Parse an entire HTML document or a document fragment. Use lowercase translation for names of tags and attributes. * @param document a HTML code to parse. * @param encoding an encoding to use for a parser. * @return a parsed document representation. */ public static Document parseDocument(String document, String encoding) throws IOException, SAXException { DOMParser parser = new DOMParser(new HTMLConfiguration()); try { // These URLs are predefined parameters' names (check org.cyberneko.html.HTMLConfiguration for more information) parser.setProperty("http://cyberneko.org/html/properties/names/elems", "lower"); parser.setProperty("http://cyberneko.org/html/properties/default-encoding", encoding); } catch (SAXNotRecognizedException | SAXNotSupportedException e) { logger.error("Unexpected parser configuration error occurred: " + e.getMessage()); throw new RuntimeException(e); } StringReader reader = new StringReader(document); InputSource source = new InputSource(reader); parser.parse(source); return parser.getDocument(); }
Example #15
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 #16
Source File: SAXDocumentParser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name.equals(Properties.LEXICAL_HANDLER_PROPERTY)) { return getLexicalHandler(); } else if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { return getDeclHandler(); } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { return getExternalVocabularies(); } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { return getRegisteredEncodingAlgorithms(); } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { return getEncodingAlgorithmContentHandler(); } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { return getPrimitiveTypeContentHandler(); } else { throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). getString("message.propertyNotRecognized", new Object[]{name})); } }
Example #17
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 #18
Source File: DOMParser.java From TencentKona-8 with GNU General Public License v2.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 #19
Source File: SAXParserImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public synchronized boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { // TODO: Add localized error message. throw new NullPointerException(); } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return fSecurityManager.isSecureProcessing(); } return super.getFeature(name); }
Example #20
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 #21
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 #22
Source File: CLDRConverter.java From dragonwell8_jdk 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 #23
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 #24
Source File: SAXParserFactoryImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * returns the particular property requested for in the underlying * implementation of org.xml.sax.XMLReader. */ public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(); } if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { return fSecureProcess; } // Check for valid name by creating a dummy XMLReader to get // feature value return newSAXParserImpl().getXMLReader().getFeature(name); }
Example #25
Source File: XMLSchemaFactory.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException { if (name == null) { throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "ProperyNameNull", null)); } if (name.equals(SECURITY_MANAGER)) { return fSecurityManager; } else if (name.equals(XMLGRAMMAR_POOL)) { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object [] {name})); } try { return fXMLSchemaLoader.getProperty(name); } catch (XMLConfigurationException e) { String identifier = e.getIdentifier(); if (e.getType() == Status.NOT_RECOGNIZED) { throw new SAXNotRecognizedException( SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-recognized", new Object [] {identifier})); } else { throw new SAXNotSupportedException( SAXMessageFormatter.formatMessage(fXMLSchemaLoader.getLocale(), "property-not-supported", new Object [] {identifier})); } } }
Example #26
Source File: LibraryHints.java From ghidra with Apache License 2.0 | 5 votes |
private void readLibraryHints(ResourceFile hintsFile) { InputStream is = null; try { is = new BufferedInputStream(hintsFile.getInputStream()); SAXBuilder sax = XmlUtilities.createSecureSAXBuilder(false, false); Document document = sax.build(is); Element root = document.getRootElement(); if (!"LIBRARY_HINTS".equals(root.getName())) { throw new SAXNotRecognizedException("Expected LIBRARY_HINTS document"); } Iterator<?> iter = root.getChildren().iterator(); while (iter.hasNext()) { Element element = (Element) iter.next(); if ("HINT".equals(element.getName())) { parseHint(element); } else { throw new SAXNotRecognizedException("Unexpected element: " + element.getName()); } } } catch (Exception e) { Msg.error(this, "Error occurred while parsing hints file: " + hintsFile, e); } finally { if (is != null) { try { is.close(); } catch (IOException e1) { } } } }
Example #27
Source File: TestSAXDriver.java From dragonwell8_jdk 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 #28
Source File: JAXBSource.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
public void setProperty(String name, Object value) throws SAXNotRecognizedException { if( "http://xml.org/sax/properties/lexical-handler".equals(name) ) { this.lexicalHandler = (LexicalHandler)value; return; } throw new SAXNotRecognizedException(name); }
Example #29
Source File: DOMParser.java From jdk1.8-source-analysis with Apache License 2.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: 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})); } } }