com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver Java Examples
The following examples show how to use
com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver.
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: XMLGrammarCachingConfiguration.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
DTDGrammar parseDTD(XMLInputSource is) throws IOException { XMLEntityResolver resolver = getEntityResolver(); if(resolver != null) { fDTDLoader.setEntityResolver(resolver); } fDTDLoader.setProperty(ERROR_REPORTER, fErrorReporter); // Should check whether the grammar with this namespace is already in // the grammar resolver. But since we don't know the target namespace // of the document here, we leave such check to the application... DTDGrammar grammar = (DTDGrammar)fDTDLoader.loadGrammar(is); // by default, hand it off to the grammar pool if (grammar != null) { fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD, new Grammar[]{grammar}); } return grammar; }
Example #2
Source File: DOMParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Return the current entity resolver. * * @return The current entity resolver, or null if none * has been registered. * @see #setEntityResolver */ public EntityResolver getEntityResolver() { EntityResolver entityResolver = null; try { XMLEntityResolver xmlEntityResolver = (XMLEntityResolver)fConfiguration.getProperty(ENTITY_RESOLVER); if (xmlEntityResolver != null) { if (xmlEntityResolver instanceof EntityResolverWrapper) { entityResolver = ((EntityResolverWrapper) xmlEntityResolver).getEntityResolver(); } else if (xmlEntityResolver instanceof EntityResolver2Wrapper) { entityResolver = ((EntityResolver2Wrapper) xmlEntityResolver).getEntityResolver(); } } } catch (XMLConfigurationException e) { // do nothing } return entityResolver; }
Example #3
Source File: DOMParser.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Return the current entity resolver. * * @return The current entity resolver, or null if none * has been registered. * @see #setEntityResolver */ public EntityResolver getEntityResolver() { EntityResolver entityResolver = null; try { XMLEntityResolver xmlEntityResolver = (XMLEntityResolver)fConfiguration.getProperty(ENTITY_RESOLVER); if (xmlEntityResolver != null) { if (xmlEntityResolver instanceof EntityResolverWrapper) { entityResolver = ((EntityResolverWrapper) xmlEntityResolver).getEntityResolver(); } else if (xmlEntityResolver instanceof EntityResolver2Wrapper) { entityResolver = ((EntityResolver2Wrapper) xmlEntityResolver).getEntityResolver(); } } } catch (XMLConfigurationException e) { // do nothing } return entityResolver; }
Example #4
Source File: XMLGrammarCachingConfiguration.java From hottub with GNU General Public License v2.0 | 6 votes |
DTDGrammar parseDTD(XMLInputSource is) throws IOException { XMLEntityResolver resolver = getEntityResolver(); if(resolver != null) { fDTDLoader.setEntityResolver(resolver); } fDTDLoader.setProperty(ERROR_REPORTER, fErrorReporter); // Should check whether the grammar with this namespace is already in // the grammar resolver. But since we don't know the target namespace // of the document here, we leave such check to the application... DTDGrammar grammar = (DTDGrammar)fDTDLoader.loadGrammar(is); // by default, hand it off to the grammar pool if (grammar != null) { fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD, new Grammar[]{grammar}); } return grammar; }
Example #5
Source File: AbstractSAXParser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Return the current entity resolver. * * @return The current entity resolver, or null if none * has been registered. * @see #setEntityResolver */ public EntityResolver getEntityResolver() { EntityResolver entityResolver = null; try { XMLEntityResolver xmlEntityResolver = (XMLEntityResolver)fConfiguration.getProperty(ENTITY_RESOLVER); if (xmlEntityResolver != null) { if (xmlEntityResolver instanceof EntityResolverWrapper) { entityResolver = ((EntityResolverWrapper) xmlEntityResolver).getEntityResolver(); } else if (xmlEntityResolver instanceof EntityResolver2Wrapper) { entityResolver = ((EntityResolver2Wrapper) xmlEntityResolver).getEntityResolver(); } } } catch (XMLConfigurationException e) { // do nothing } return entityResolver; }
Example #6
Source File: AbstractSAXParser.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Return the current entity resolver. * * @return The current entity resolver, or null if none * has been registered. * @see #setEntityResolver */ public EntityResolver getEntityResolver() { EntityResolver entityResolver = null; try { XMLEntityResolver xmlEntityResolver = (XMLEntityResolver)fConfiguration.getProperty(ENTITY_RESOLVER); if (xmlEntityResolver != null) { if (xmlEntityResolver instanceof EntityResolverWrapper) { entityResolver = ((EntityResolverWrapper) xmlEntityResolver).getEntityResolver(); } else if (xmlEntityResolver instanceof EntityResolver2Wrapper) { entityResolver = ((EntityResolver2Wrapper) xmlEntityResolver).getEntityResolver(); } } } catch (XMLConfigurationException e) { // do nothing } return entityResolver; }
Example #7
Source File: XMLGrammarCachingConfiguration.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
DTDGrammar parseDTD(XMLInputSource is) throws IOException { XMLEntityResolver resolver = getEntityResolver(); if(resolver != null) { fDTDLoader.setEntityResolver(resolver); } fDTDLoader.setProperty(ERROR_REPORTER, fErrorReporter); // Should check whether the grammar with this namespace is already in // the grammar resolver. But since we don't know the target namespace // of the document here, we leave such check to the application... DTDGrammar grammar = (DTDGrammar)fDTDLoader.loadGrammar(is); // by default, hand it off to the grammar pool if (grammar != null) { fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_DTD, new Grammar[]{grammar}); } return grammar; }
Example #8
Source File: DOMParser.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Return the current entity resolver. * * @return The current entity resolver, or null if none * has been registered. * @see #setEntityResolver */ public EntityResolver getEntityResolver() { EntityResolver entityResolver = null; try { XMLEntityResolver xmlEntityResolver = (XMLEntityResolver)fConfiguration.getProperty(ENTITY_RESOLVER); if (xmlEntityResolver != null) { if (xmlEntityResolver instanceof EntityResolverWrapper) { entityResolver = ((EntityResolverWrapper) xmlEntityResolver).getEntityResolver(); } else if (xmlEntityResolver instanceof EntityResolver2Wrapper) { entityResolver = ((EntityResolver2Wrapper) xmlEntityResolver).getEntityResolver(); } } } catch (XMLConfigurationException e) { // do nothing } return entityResolver; }
Example #9
Source File: AbstractSAXParser.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Sets the resolver used to resolve external entities. The EntityResolver * interface supports resolution of public and system identifiers. * * @param resolver The new entity resolver. Passing a null value will * uninstall the currently installed resolver. */ public void setEntityResolver(EntityResolver resolver) { try { XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER); if (fUseEntityResolver2 && resolver instanceof EntityResolver2) { if (xer instanceof EntityResolver2Wrapper) { EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer; er2w.setEntityResolver((EntityResolver2) resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolver2Wrapper((EntityResolver2) resolver)); } } else { if (xer instanceof EntityResolverWrapper) { EntityResolverWrapper erw = (EntityResolverWrapper) xer; erw.setEntityResolver(resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); } } } catch (XMLConfigurationException e) { // do nothing } }
Example #10
Source File: JAXPValidatorComponent.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException { // obtain references from the manager fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE); fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER); try { fEntityResolver = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER); } catch (XMLConfigurationException e) { fEntityResolver = null; } }
Example #11
Source File: XMLDTDLoader.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Sets the value of a property. This method is called by the component * manager any time after reset when a property changes value. * <p> * <strong>Note:</strong> Components should silently ignore properties * that do not affect the operation of the component. * * @param propertyId The property identifier. * @param value The value of the property. * * @throws SAXNotRecognizedException The component should not throw * this exception. * @throws SAXNotSupportedException The component should not throw * this exception. */ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { if (propertyId.equals(SYMBOL_TABLE)) { fSymbolTable = (SymbolTable)value; fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if(propertyId.equals(ERROR_REPORTER)) { fErrorReporter = (XMLErrorReporter)value; // Add XML message formatter if there isn't one. if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(ERROR_HANDLER)) { fErrorReporter.setProperty(propertyId, value); } else if (propertyId.equals(ENTITY_RESOLVER)) { fEntityResolver = (XMLEntityResolver)value; fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(LOCALE)) { setLocale((Locale) value); } else if(propertyId.equals(GRAMMAR_POOL)) { fGrammarPool = (XMLGrammarPool)value; } else { throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId); } }
Example #12
Source File: XMLDTDLoader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets the value of a property. This method is called by the component * manager any time after reset when a property changes value. * <p> * <strong>Note:</strong> Components should silently ignore properties * that do not affect the operation of the component. * * @param propertyId The property identifier. * @param value The value of the property. * * @throws SAXNotRecognizedException The component should not throw * this exception. * @throws SAXNotSupportedException The component should not throw * this exception. */ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { if (propertyId.equals(SYMBOL_TABLE)) { fSymbolTable = (SymbolTable)value; fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if(propertyId.equals(ERROR_REPORTER)) { fErrorReporter = (XMLErrorReporter)value; // Add XML message formatter if there isn't one. if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(ERROR_HANDLER)) { fErrorReporter.setProperty(propertyId, value); } else if (propertyId.equals(ENTITY_RESOLVER)) { fEntityResolver = (XMLEntityResolver)value; fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(LOCALE)) { setLocale((Locale) value); } else if(propertyId.equals(GRAMMAR_POOL)) { fGrammarPool = (XMLGrammarPool)value; } else { throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId); } }
Example #13
Source File: DOMParser.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Sets the resolver used to resolve external entities. The EntityResolver * interface supports resolution of public and system identifiers. * * @param resolver The new entity resolver. Passing a null value will * uninstall the currently installed resolver. */ public void setEntityResolver(EntityResolver resolver) { try { XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER); if (fUseEntityResolver2 && resolver instanceof EntityResolver2) { if (xer instanceof EntityResolver2Wrapper) { EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer; er2w.setEntityResolver((EntityResolver2) resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolver2Wrapper((EntityResolver2) resolver)); } } else { if (xer instanceof EntityResolverWrapper) { EntityResolverWrapper erw = (EntityResolverWrapper) xer; erw.setEntityResolver(resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); } } } catch (XMLConfigurationException e) { // do nothing } }
Example #14
Source File: AbstractSAXParser.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets the resolver used to resolve external entities. The EntityResolver * interface supports resolution of public and system identifiers. * * @param resolver The new entity resolver. Passing a null value will * uninstall the currently installed resolver. */ public void setEntityResolver(EntityResolver resolver) { try { XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER); if (fUseEntityResolver2 && resolver instanceof EntityResolver2) { if (xer instanceof EntityResolver2Wrapper) { EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer; er2w.setEntityResolver((EntityResolver2) resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolver2Wrapper((EntityResolver2) resolver)); } } else { if (xer instanceof EntityResolverWrapper) { EntityResolverWrapper erw = (EntityResolverWrapper) xer; erw.setEntityResolver(resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); } } } catch (XMLConfigurationException e) { // do nothing } }
Example #15
Source File: JAXPValidatorComponent.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public void reset(XMLComponentManager componentManager) throws XMLConfigurationException { // obtain references from the manager fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE); fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER); try { fEntityResolver = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER); } catch (XMLConfigurationException e) { fEntityResolver = null; } }
Example #16
Source File: AbstractSAXParser.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Sets the resolver used to resolve external entities. The EntityResolver * interface supports resolution of public and system identifiers. * * @param resolver The new entity resolver. Passing a null value will * uninstall the currently installed resolver. */ public void setEntityResolver(EntityResolver resolver) { try { XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER); if (fUseEntityResolver2 && resolver instanceof EntityResolver2) { if (xer instanceof EntityResolver2Wrapper) { EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer; er2w.setEntityResolver((EntityResolver2) resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolver2Wrapper((EntityResolver2) resolver)); } } else { if (xer instanceof EntityResolverWrapper) { EntityResolverWrapper erw = (EntityResolverWrapper) xer; erw.setEntityResolver(resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); } } } catch (XMLConfigurationException e) { // do nothing } }
Example #17
Source File: XMLDTDLoader.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Sets the value of a property. This method is called by the component * manager any time after reset when a property changes value. * <p> * <strong>Note:</strong> Components should silently ignore properties * that do not affect the operation of the component. * * @param propertyId The property identifier. * @param value The value of the property. * * @throws SAXNotRecognizedException The component should not throw * this exception. * @throws SAXNotSupportedException The component should not throw * this exception. */ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { if (propertyId.equals(SYMBOL_TABLE)) { fSymbolTable = (SymbolTable)value; fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if(propertyId.equals(ERROR_REPORTER)) { fErrorReporter = (XMLErrorReporter)value; // Add XML message formatter if there isn't one. if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(ERROR_HANDLER)) { fErrorReporter.setProperty(propertyId, value); } else if (propertyId.equals(ENTITY_RESOLVER)) { fEntityResolver = (XMLEntityResolver)value; fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(LOCALE)) { setLocale((Locale) value); } else if(propertyId.equals(GRAMMAR_POOL)) { fGrammarPool = (XMLGrammarPool)value; } else { throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId); } }
Example #18
Source File: XMLDTDLoader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Sets the value of a property. This method is called by the component * manager any time after reset when a property changes value. * <p> * <strong>Note:</strong> Components should silently ignore properties * that do not affect the operation of the component. * * @param propertyId The property identifier. * @param value The value of the property. * * @throws SAXNotRecognizedException The component should not throw * this exception. * @throws SAXNotSupportedException The component should not throw * this exception. */ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { if (propertyId.equals(SYMBOL_TABLE)) { fSymbolTable = (SymbolTable)value; fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if(propertyId.equals(ERROR_REPORTER)) { fErrorReporter = (XMLErrorReporter)value; // Add XML message formatter if there isn't one. if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(ERROR_HANDLER)) { fErrorReporter.setProperty(propertyId, value); } else if (propertyId.equals(ENTITY_RESOLVER)) { fEntityResolver = (XMLEntityResolver)value; fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(LOCALE)) { setLocale((Locale) value); } else if(propertyId.equals(GRAMMAR_POOL)) { fGrammarPool = (XMLGrammarPool)value; } else { throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId); } }
Example #19
Source File: DOMParser.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Sets the resolver used to resolve external entities. The EntityResolver * interface supports resolution of public and system identifiers. * * @param resolver The new entity resolver. Passing a null value will * uninstall the currently installed resolver. */ public void setEntityResolver(EntityResolver resolver) { try { XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER); if (fUseEntityResolver2 && resolver instanceof EntityResolver2) { if (xer instanceof EntityResolver2Wrapper) { EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer; er2w.setEntityResolver((EntityResolver2) resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolver2Wrapper((EntityResolver2) resolver)); } } else { if (xer instanceof EntityResolverWrapper) { EntityResolverWrapper erw = (EntityResolverWrapper) xer; erw.setEntityResolver(resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); } } } catch (XMLConfigurationException e) { // do nothing } }
Example #20
Source File: XMLSchemaLoader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * This method tries to resolve location of the given schema. * The loader stores the namespace/location pairs in a map (use "" as the * namespace of absent namespace). When resolving an entity, loader first tries * to find in the map whether there is a value for that namespace, * if so, pass that location value to the user-defined entity resolver. * * @param desc * @param locationPairs * @param entityResolver * @return the XMLInputSource * @throws IOException */ public static XMLInputSource resolveDocument(XSDDescription desc, Map<String, LocationArray> locationPairs, XMLEntityResolver entityResolver) throws IOException { String loc = null; // we consider the schema location properties for import if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) { // use empty string as the key for absent namespace String namespace = desc.getTargetNamespace(); String ns = namespace == null ? XMLSymbols.EMPTY_STRING : namespace; // get the location hint for that namespace LocationArray tempLA = locationPairs.get(ns); if(tempLA != null) loc = tempLA.getFirstLocation(); } // if it's not import, or if the target namespace is not set // in the schema location properties, use location hint if (loc == null) { String[] hints = desc.getLocationHints(); if (hints != null && hints.length > 0) loc = hints[0]; } String expandedLoc = XMLEntityManager.expandSystemId(loc, desc.getBaseSystemId(), false); desc.setLiteralSystemId(loc); desc.setExpandedSystemId(expandedLoc); return entityResolver.resolveEntity(desc); }
Example #21
Source File: AbstractSAXParser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets the resolver used to resolve external entities. The EntityResolver * interface supports resolution of public and system identifiers. * * @param resolver The new entity resolver. Passing a null value will * uninstall the currently installed resolver. */ public void setEntityResolver(EntityResolver resolver) { try { XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER); if (fUseEntityResolver2 && resolver instanceof EntityResolver2) { if (xer instanceof EntityResolver2Wrapper) { EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer; er2w.setEntityResolver((EntityResolver2) resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolver2Wrapper((EntityResolver2) resolver)); } } else { if (xer instanceof EntityResolverWrapper) { EntityResolverWrapper erw = (EntityResolverWrapper) xer; erw.setEntityResolver(resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); } } } catch (XMLConfigurationException e) { // do nothing } }
Example #22
Source File: XMLDTDLoader.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Sets the value of a property. This method is called by the component * manager any time after reset when a property changes value. * <p> * <strong>Note:</strong> Components should silently ignore properties * that do not affect the operation of the component. * * @param propertyId The property identifier. * @param value The value of the property. * * @throws SAXNotRecognizedException The component should not throw * this exception. * @throws SAXNotSupportedException The component should not throw * this exception. */ public void setProperty(String propertyId, Object value) throws XMLConfigurationException { if (propertyId.equals(SYMBOL_TABLE)) { fSymbolTable = (SymbolTable)value; fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if(propertyId.equals(ERROR_REPORTER)) { fErrorReporter = (XMLErrorReporter)value; // Add XML message formatter if there isn't one. if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { XMLMessageFormatter xmft = new XMLMessageFormatter(); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); fErrorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft); } fDTDScanner.setProperty(propertyId, value); fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(ERROR_HANDLER)) { fErrorReporter.setProperty(propertyId, value); } else if (propertyId.equals(ENTITY_RESOLVER)) { fEntityResolver = (XMLEntityResolver)value; fEntityManager.setProperty(propertyId, value); } else if (propertyId.equals(LOCALE)) { setLocale((Locale) value); } else if(propertyId.equals(GRAMMAR_POOL)) { fGrammarPool = (XMLGrammarPool)value; } else { throw new XMLConfigurationException(Status.NOT_RECOGNIZED, propertyId); } }
Example #23
Source File: DOMParser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets the resolver used to resolve external entities. The EntityResolver * interface supports resolution of public and system identifiers. * * @param resolver The new entity resolver. Passing a null value will * uninstall the currently installed resolver. */ public void setEntityResolver(EntityResolver resolver) { try { XMLEntityResolver xer = (XMLEntityResolver) fConfiguration.getProperty(ENTITY_RESOLVER); if (fUseEntityResolver2 && resolver instanceof EntityResolver2) { if (xer instanceof EntityResolver2Wrapper) { EntityResolver2Wrapper er2w = (EntityResolver2Wrapper) xer; er2w.setEntityResolver((EntityResolver2) resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolver2Wrapper((EntityResolver2) resolver)); } } else { if (xer instanceof EntityResolverWrapper) { EntityResolverWrapper erw = (EntityResolverWrapper) xer; erw.setEntityResolver(resolver); } else { fConfiguration.setProperty(ENTITY_RESOLVER, new EntityResolverWrapper(resolver)); } } } catch (XMLConfigurationException e) { // do nothing } }
Example #24
Source File: XMLGrammarPreparser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** Returns the registered entity resolver. */ public XMLEntityResolver getEntityResolver() { return fEntityResolver; }
Example #25
Source File: XML11DTDProcessor.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
XML11DTDProcessor(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLErrorReporter errorReporter, XMLEntityResolver entityResolver) { super(symbolTable, grammarPool, errorReporter, entityResolver); }
Example #26
Source File: XIncludeHandler.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Sets the value of a property. This method is called by the component * manager any time after reset when a property changes value. * <p> * <strong>Note:</strong> Components should silently ignore properties * that do not affect the operation of the component. * * @param propertyId The property identifier. * @param value The value of the property. * * @throws SAXNotRecognizedException The component should not throw * this exception. * @throws SAXNotSupportedException The component should not throw * this exception. */ @Override public void setProperty(String propertyId, Object value) throws XMLConfigurationException { if (propertyId.equals(SYMBOL_TABLE)) { fSymbolTable = (SymbolTable)value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(ERROR_REPORTER)) { setErrorReporter((XMLErrorReporter)value); if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(ENTITY_RESOLVER)) { fEntityResolver = (XMLEntityResolver)value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(SECURITY_MANAGER)) { fSecurityManager = (XMLSecurityManager)value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(XML_SECURITY_PROPERTY_MANAGER)) { fSecurityPropertyMgr = (XMLSecurityPropertyManager)value; if (fChildConfig != null) { fChildConfig.setProperty(XML_SECURITY_PROPERTY_MANAGER, value); } return; } if (propertyId.equals(BUFFER_SIZE)) { Integer bufferSize = (Integer) value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } if (bufferSize != null && bufferSize.intValue() > 0) { fBufferSize = bufferSize.intValue(); // Reset XML 1.0 text reader. if (fXInclude10TextReader != null) { fXInclude10TextReader.setBufferSize(fBufferSize); } // Reset XML 1.1 text reader. if (fXInclude11TextReader != null) { fXInclude11TextReader.setBufferSize(fBufferSize); } } return; } }
Example #27
Source File: XML11DTDProcessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
XML11DTDProcessor(SymbolTable symbolTable, XMLGrammarPool grammarPool, XMLErrorReporter errorReporter, XMLEntityResolver entityResolver) { super(symbolTable, grammarPool, errorReporter, entityResolver); }
Example #28
Source File: XIncludeHandler.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Sets the value of a property. This method is called by the component * manager any time after reset when a property changes value. * <p> * <strong>Note:</strong> Components should silently ignore properties * that do not affect the operation of the component. * * @param propertyId The property identifier. * @param value The value of the property. * * @throws SAXNotRecognizedException The component should not throw * this exception. * @throws SAXNotSupportedException The component should not throw * this exception. */ @Override public void setProperty(String propertyId, Object value) throws XMLConfigurationException { if (propertyId.equals(SYMBOL_TABLE)) { fSymbolTable = (SymbolTable)value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(ERROR_REPORTER)) { setErrorReporter((XMLErrorReporter)value); if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(ENTITY_RESOLVER)) { fEntityResolver = (XMLEntityResolver)value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(SECURITY_MANAGER)) { fSecurityManager = (XMLSecurityManager)value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } return; } if (propertyId.equals(XML_SECURITY_PROPERTY_MANAGER)) { fSecurityPropertyMgr = (XMLSecurityPropertyManager)value; if (fChildConfig != null) { fChildConfig.setProperty(XML_SECURITY_PROPERTY_MANAGER, value); } return; } if (propertyId.equals(BUFFER_SIZE)) { Integer bufferSize = (Integer) value; if (fChildConfig != null) { fChildConfig.setProperty(propertyId, value); } if (bufferSize != null && bufferSize.intValue() > 0) { fBufferSize = bufferSize.intValue(); // Reset XML 1.0 text reader. if (fXInclude10TextReader != null) { fXInclude10TextReader.setBufferSize(fBufferSize); } // Reset XML 1.1 text reader. if (fXInclude11TextReader != null) { fXInclude11TextReader.setBufferSize(fBufferSize); } } return; } }
Example #29
Source File: DOMConfigurationImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * DOM Level 3 WD - Experimental. * Check if setting a parameter to a specific value is supported. * * @param name The name of the parameter to check. * * @param value An object. if null, the returned value is true. * * @return true if the parameter could be successfully set to the * specified value, or false if the parameter is not recognized or * the requested value is not supported. This does not change the * current value of the parameter itself. */ public boolean canSetParameter(String name, Object value) { if (value == null){ //if null, the returned value is true. //REVISIT: I dont like this --- even for unrecognized parameter it would //return 'true'. I think it should return false in that case. // Application will be surprised to find that setParameter throws not //recognized exception when canSetParameter returns 'true' Then what is the use //of having canSetParameter ??? - nb. return true ; } if( value instanceof Boolean ){ //features whose parameter value can be set either 'true' or 'false' // or they accept any boolean value -- so we just need to check that // its a boolean value.. if (name.equalsIgnoreCase(Constants.DOM_COMMENTS) || name.equalsIgnoreCase(Constants.DOM_DATATYPE_NORMALIZATION) || name.equalsIgnoreCase(Constants.DOM_CDATA_SECTIONS) || name.equalsIgnoreCase(Constants.DOM_ENTITIES) || name.equalsIgnoreCase(Constants.DOM_SPLIT_CDATA) || name.equalsIgnoreCase(Constants.DOM_NAMESPACES) || name.equalsIgnoreCase(Constants.DOM_VALIDATE) || name.equalsIgnoreCase(Constants.DOM_WELLFORMED) || name.equalsIgnoreCase(Constants.DOM_INFOSET) || name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS) ) { return true; }//features whose parameter value can not be set to 'true' else if ( name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS) || name.equalsIgnoreCase(Constants.DOM_CANONICAL_FORM) || name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA) || name.equalsIgnoreCase(Constants.DOM_CHECK_CHAR_NORMALIZATION) ) { return (value.equals(Boolean.TRUE)) ? false : true; }//features whose parameter value can not be set to 'false' else if( name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE) || name.equalsIgnoreCase(SEND_PSVI) ) { return (value.equals(Boolean.TRUE)) ? true : false; }// if name is not among the above listed above -- its not recognized. return false else { return false ; } } else if (name.equalsIgnoreCase(Constants.DOM_ERROR_HANDLER)) { return (value instanceof DOMErrorHandler) ? true : false ; } else if (name.equalsIgnoreCase(Constants.DOM_RESOURCE_RESOLVER)) { return (value instanceof LSResourceResolver) ? true : false ; } else if (name.equalsIgnoreCase(Constants.DOM_SCHEMA_LOCATION)) { return (value instanceof String) ? true : false ; } else if (name.equalsIgnoreCase(Constants.DOM_SCHEMA_TYPE)) { // REVISIT: should null value be supported? // as of now we are only supporting W3C XML Schema and DTD. return ((value instanceof String) && (value.equals(Constants.NS_XMLSCHEMA) || value.equals(Constants.NS_DTD))) ? true : false; } else if (name.equalsIgnoreCase(ENTITY_RESOLVER)) { return (value instanceof XMLEntityResolver) ? true : false; } else if (name.equalsIgnoreCase(SYMBOL_TABLE)) { // Xerces Symbol Table return (value instanceof SymbolTable) ? true : false; } else if (name.equalsIgnoreCase (GRAMMAR_POOL)) { return (value instanceof XMLGrammarPool) ? true : false; } else { //false if the parameter is not recognized or the requested value is not supported. return false ; } }
Example #30
Source File: XMLGrammarLoader.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** Returns the registered entity resolver. */ public XMLEntityResolver getEntityResolver();