org.xml.sax.ext.DeclHandler Java Examples
The following examples show how to use
org.xml.sax.ext.DeclHandler.
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: BaseXMLReader.java From jlibs with Apache License 2.0 | 6 votes |
protected boolean _setProperty(String name, Object value) throws SAXNotSupportedException{ if(LEXICAL_HANDLER.equals(name) || LEXICAL_HANDLER_ALT.equals(name)){ if(value==null || value instanceof LexicalHandler){ handler.setLexicalHandler((LexicalHandler)value); return true; }else throw new SAXNotSupportedException("value must implement "+LexicalHandler.class); }else if(DECL_HANDLER.equals(name) || DECL_HANDLER_ALT.equals(name)){ if(value==null || value instanceof DeclHandler){ handler.setDeclHandler((DeclHandler)value); return true; }else throw new SAXNotSupportedException("value must implement "+DeclHandler.class); }else return false; }
Example #2
Source File: SAXDecoder.java From exificient with MIT License | 6 votes |
public DocTypeTextLexicalHandler(DeclHandler dh) throws SAXException { // this.dh = dh; xmlReader = XMLReaderFactory.createXMLReader(); // xmlReader.setProperty( // "http://xml.org/sax/properties/lexical-handler", // lh); // DTD xmlReader.setFeature( "http://xml.org/sax/features/resolve-dtd-uris", false); // *skip* resolving entities like DTDs xmlReader.setEntityResolver(new NoEntityResolver()); xmlReader.setProperty( "http://xml.org/sax/properties/declaration-handler", dh); }
Example #3
Source File: AsyncXMLReader.java From jlibs with Apache License 2.0 | 5 votes |
@Override public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException{ if(LEXICAL_HANDLER.equals(name) || LEXICAL_HANDLER_ALT.equals(name)){ if(value==null || value instanceof LexicalHandler) lexicalHandler = (LexicalHandler)value; else throw new SAXNotSupportedException("value must implement "+LexicalHandler.class); }else if(DECL_HANDLER.equals(name) || DECL_HANDLER_ALT.equals(name)){ if(value==null || value instanceof DeclHandler) declHandler = (DeclHandler)value; else throw new SAXNotSupportedException("value must implement "+DeclHandler.class); }else throw new SAXNotRecognizedException(); }
Example #4
Source File: SAXParserTest02.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Test to set and get the declaration-handler. * * @param saxparser a SAXParser instance. * @throws SAXException If any parse errors occur. */ @Test(dataProvider = "parser-provider") public void testProperty06(SAXParser saxparser) throws SAXException { MyDeclHandler myDeclHandler = new MyDeclHandler(); saxparser.setProperty(DECL_HANDLER, myDeclHandler); assertTrue(saxparser.getProperty(DECL_HANDLER) instanceof DeclHandler); }
Example #5
Source File: SAXDelegate.java From jlibs with Apache License 2.0 | 5 votes |
/** * Registers given handler with all its implementing interfaces. * This would be handy if you want to register to all interfaces * implemented by given handler object * * @param handler Object implementing one or more sax handler interfaces */ public void setHandler(Object handler){ if(handler instanceof ContentHandler) setContentHandler((ContentHandler)handler); if(handler instanceof EntityResolver) setEntityResolver((EntityResolver)handler); if(handler instanceof ErrorHandler) setErrorHandler((ErrorHandler)handler); if(handler instanceof DTDHandler) setDTDHandler((DTDHandler)handler); if(handler instanceof LexicalHandler) setLexicalHandler((LexicalHandler)handler); if(handler instanceof DeclHandler) setDeclHandler((DeclHandler)handler); }
Example #6
Source File: SAXDecoder.java From exificient with MIT License | 5 votes |
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 if ("http://xml.org/sax/properties/declaration-handler" .equals(name)) { this.declHandler = (DeclHandler) value; } else { throw new SAXNotRecognizedException(name); } }
Example #7
Source File: SAXDocumentParser.java From hottub with GNU General Public License v2.0 | 4 votes |
public DeclHandler getDeclHandler() { return _declHandler; }
Example #8
Source File: SAXDocumentParser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public DeclHandler getDeclHandler() { return _declHandler; }
Example #9
Source File: SAXDocumentParser.java From hottub with GNU General Public License v2.0 | 4 votes |
public void setDeclHandler(DeclHandler handler) { _declHandler = handler; }
Example #10
Source File: SAXDocumentParser.java From hottub with GNU General Public License v2.0 | 4 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 if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { if (value instanceof DeclHandler) { setDeclHandler((DeclHandler)value); } else { throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { if (value instanceof Map) { setExternalVocabularies((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY); } } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { if (value instanceof Map) { setRegisteredEncodingAlgorithms((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY); } } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { if (value instanceof EncodingAlgorithmContentHandler) { setEncodingAlgorithmContentHandler((EncodingAlgorithmContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { if (value instanceof PrimitiveTypeContentHandler) { setPrimitiveTypeContentHandler((PrimitiveTypeContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.BUFFER_SIZE_PROPERTY)) { if (value instanceof Integer) { setBufferSize(((Integer)value).intValue()); } else { throw new SAXNotSupportedException(FastInfosetReader.BUFFER_SIZE_PROPERTY); } } else { throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). getString("message.propertyNotRecognized", new Object[]{name})); } }
Example #11
Source File: SAXDocumentParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public DeclHandler getDeclHandler() { return _declHandler; }
Example #12
Source File: SAXDocumentParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void setDeclHandler(DeclHandler handler) { _declHandler = handler; }
Example #13
Source File: SAXDocumentParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public DeclHandler getDeclHandler() { return _declHandler; }
Example #14
Source File: SAXDocumentParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public void setDeclHandler(DeclHandler handler) { _declHandler = handler; }
Example #15
Source File: SAXDocumentParser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 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 if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { if (value instanceof DeclHandler) { setDeclHandler((DeclHandler)value); } else { throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { if (value instanceof Map) { setExternalVocabularies((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY); } } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { if (value instanceof Map) { setRegisteredEncodingAlgorithms((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY); } } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { if (value instanceof EncodingAlgorithmContentHandler) { setEncodingAlgorithmContentHandler((EncodingAlgorithmContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { if (value instanceof PrimitiveTypeContentHandler) { setPrimitiveTypeContentHandler((PrimitiveTypeContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.BUFFER_SIZE_PROPERTY)) { if (value instanceof Integer) { setBufferSize(((Integer)value).intValue()); } else { throw new SAXNotSupportedException(FastInfosetReader.BUFFER_SIZE_PROPERTY); } } else { throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). getString("message.propertyNotRecognized", new Object[]{name})); } }
Example #16
Source File: SAXDocumentParser.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public void setDeclHandler(DeclHandler handler) { _declHandler = handler; }
Example #17
Source File: SAXDocumentParser.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public DeclHandler getDeclHandler() { return _declHandler; }
Example #18
Source File: SAXDocumentParser.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public DeclHandler getDeclHandler() { return _declHandler; }
Example #19
Source File: SAXDocumentParser.java From openjdk-8-source with GNU General Public License v2.0 | 4 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 if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { if (value instanceof DeclHandler) { setDeclHandler((DeclHandler)value); } else { throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { if (value instanceof Map) { setExternalVocabularies((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY); } } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { if (value instanceof Map) { setRegisteredEncodingAlgorithms((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY); } } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { if (value instanceof EncodingAlgorithmContentHandler) { setEncodingAlgorithmContentHandler((EncodingAlgorithmContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { if (value instanceof PrimitiveTypeContentHandler) { setPrimitiveTypeContentHandler((PrimitiveTypeContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.BUFFER_SIZE_PROPERTY)) { if (value instanceof Integer) { setBufferSize(((Integer)value).intValue()); } else { throw new SAXNotSupportedException(FastInfosetReader.BUFFER_SIZE_PROPERTY); } } else { throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). getString("message.propertyNotRecognized", new Object[]{name})); } }
Example #20
Source File: SAXDocumentParser.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void setDeclHandler(DeclHandler handler) { _declHandler = handler; }
Example #21
Source File: SAXDocumentParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 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 if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { if (value instanceof DeclHandler) { setDeclHandler((DeclHandler)value); } else { throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { if (value instanceof Map) { setExternalVocabularies((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY); } } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { if (value instanceof Map) { setRegisteredEncodingAlgorithms((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY); } } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { if (value instanceof EncodingAlgorithmContentHandler) { setEncodingAlgorithmContentHandler((EncodingAlgorithmContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { if (value instanceof PrimitiveTypeContentHandler) { setPrimitiveTypeContentHandler((PrimitiveTypeContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.BUFFER_SIZE_PROPERTY)) { if (value instanceof Integer) { setBufferSize(((Integer)value).intValue()); } else { throw new SAXNotSupportedException(FastInfosetReader.BUFFER_SIZE_PROPERTY); } } else { throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). getString("message.propertyNotRecognized", new Object[]{name})); } }
Example #22
Source File: SAXReaderSettings.java From ph-commons with Apache License 2.0 | 4 votes |
@Nonnull public final SAXReaderSettings setDeclarationHandler (@Nullable final DeclHandler aDeclHandler) { return setPropertyValue (EXMLParserProperty.SAX_DECLARATION_HANDLER, aDeclHandler); }
Example #23
Source File: SAXDocumentParser.java From openjdk-8 with GNU General Public License v2.0 | 4 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 if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { if (value instanceof DeclHandler) { setDeclHandler((DeclHandler)value); } else { throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { if (value instanceof Map) { setExternalVocabularies((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY); } } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { if (value instanceof Map) { setRegisteredEncodingAlgorithms((Map)value); } else { throw new SAXNotSupportedException(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY); } } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { if (value instanceof EncodingAlgorithmContentHandler) { setEncodingAlgorithmContentHandler((EncodingAlgorithmContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { if (value instanceof PrimitiveTypeContentHandler) { setPrimitiveTypeContentHandler((PrimitiveTypeContentHandler)value); } else { throw new SAXNotSupportedException(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY); } } else if (name.equals(FastInfosetReader.BUFFER_SIZE_PROPERTY)) { if (value instanceof Integer) { setBufferSize(((Integer)value).intValue()); } else { throw new SAXNotSupportedException(FastInfosetReader.BUFFER_SIZE_PROPERTY); } } else { throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). getString("message.propertyNotRecognized", new Object[]{name})); } }
Example #24
Source File: SAXDocumentParser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void setDeclHandler(DeclHandler handler) { _declHandler = handler; }
Example #25
Source File: SAXDocumentParser.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public DeclHandler getDeclHandler() { return _declHandler; }
Example #26
Source File: SAXReaderDefaultSettings.java From ph-commons with Apache License 2.0 | 4 votes |
@Nullable public static DeclHandler getDeclarationHandler () { return (DeclHandler) getPropertyValue (EXMLParserProperty.SAX_DECLARATION_HANDLER); }
Example #27
Source File: SAXDelegate.java From jlibs with Apache License 2.0 | 4 votes |
public DeclHandler getDeclHandler(){ return declHandler; }
Example #28
Source File: SAXDelegate.java From jlibs with Apache License 2.0 | 4 votes |
public void setDeclHandler(DeclHandler declHandler){ this.declHandler = declHandler; }
Example #29
Source File: DTDAttribute.java From jlibs with Apache License 2.0 | 4 votes |
void fire(DeclHandler handler) throws SAXException{ if(handler!=null) handler.attributeDecl(element, name, type.toString(validValues), valueType.mode, value); }
Example #30
Source File: SAXReaderSettings.java From ph-commons with Apache License 2.0 | 4 votes |
@Nullable public DeclHandler getDeclarationHandler () { return (DeclHandler) getPropertyValue (EXMLParserProperty.SAX_DECLARATION_HANDLER); }