org.xml.sax.helpers.XMLFilterImpl Java Examples
The following examples show how to use
org.xml.sax.helpers.XMLFilterImpl.
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: JAXBSource.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void parse() throws SAXException { // parses a content object by using the given marshaller // SAX events will be sent to the repeater, and the repeater // will further forward it to an appropriate component. try { marshaller.marshal( contentObject, (XMLFilterImpl)repeater ); } catch( JAXBException e ) { // wrap it to a SAXException SAXParseException se = new SAXParseException( e.getMessage(), null, null, -1, -1, e ); // if the consumer sets an error handler, it is our responsibility // to notify it. if(errorHandler!=null) errorHandler.fatalError(se); // this is a fatal error. Even if the error handler // returns, we will abort anyway. throw se; } }
Example #2
Source File: DOMForest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Returns a {@link ContentHandler} to feed SAX events into. * * <p> * The client of this class can feed SAX events into the handler * to parse a document into this DOM forest. * * This version requires that the DOM object to be created and registered * to the map beforehand. */ private ContentHandler getParserHandler( Document dom ) { ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings); handler = new WhitespaceStripper(handler,errorReceiver,entityResolver); handler = new VersionChecker(handler,errorReceiver,entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if(errorReceiver!=null) f.setErrorHandler(errorReceiver); if(entityResolver!=null) f.setEntityResolver(entityResolver); return f; }
Example #3
Source File: DomHandlerEx.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
ResultImpl() { try { DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI s2d = new SAX2DOMEx(factory); } catch (ParserConfigurationException e) { throw new AssertionError(e); // impossible } XMLFilterImpl f = new XMLFilterImpl() { @Override public void setDocumentLocator(Locator locator) { super.setDocumentLocator(locator); location = new LocatorImpl(locator); } }; f.setContentHandler(s2d); setHandler(f); }
Example #4
Source File: JAXBSource.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public void parse() throws SAXException { // parses a content object by using the given marshaller // SAX events will be sent to the repeater, and the repeater // will further forward it to an appropriate component. try { marshaller.marshal( contentObject, (XMLFilterImpl)repeater ); } catch( JAXBException e ) { // wrap it to a SAXException SAXParseException se = new SAXParseException( e.getMessage(), null, null, -1, -1, e ); // if the consumer sets an error handler, it is our responsibility // to notify it. if(errorHandler!=null) errorHandler.fatalError(se); // this is a fatal error. Even if the error handler // returns, we will abort anyway. throw se; } }
Example #5
Source File: JAXBSource.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
public void parse() throws SAXException { // parses a content object by using the given marshaller // SAX events will be sent to the repeater, and the repeater // will further forward it to an appropriate component. try { marshaller.marshal( contentObject, (XMLFilterImpl)repeater ); } catch( JAXBException e ) { // wrap it to a SAXException SAXParseException se = new SAXParseException( e.getMessage(), null, null, -1, -1, e ); // if the consumer sets an error handler, it is our responsibility // to notify it. if(errorHandler!=null) errorHandler.fatalError(se); // this is a fatal error. Even if the error handler // returns, we will abort anyway. throw se; } }
Example #6
Source File: DOMForest.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Returns a {@link ContentHandler} to feed SAX events into. * * <p> * The client of this class can feed SAX events into the handler * to parse a document into this DOM forest. * * This version requires that the DOM object to be created and registered * to the map beforehand. */ private ContentHandler getParserHandler( Document dom ) { ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings); handler = new WhitespaceStripper(handler,errorReceiver,entityResolver); handler = new VersionChecker(handler,errorReceiver,entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if(errorReceiver!=null) f.setErrorHandler(errorReceiver); if(entityResolver!=null) f.setEntityResolver(entityResolver); return f; }
Example #7
Source File: DOMForest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Returns a {@link ContentHandler} to feed SAX events into. * * <p> * The client of this class can feed SAX events into the handler * to parse a document into this DOM forest. * * This version requires that the DOM object to be created and registered * to the map beforehand. */ private ContentHandler getParserHandler( Document dom ) { ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings); handler = new WhitespaceStripper(handler,errorReceiver,entityResolver); handler = new VersionChecker(handler,errorReceiver,entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if(errorReceiver!=null) f.setErrorHandler(errorReceiver); if(entityResolver!=null) f.setEntityResolver(entityResolver); return f; }
Example #8
Source File: JAXBSource.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public void parse() throws SAXException { // parses a content object by using the given marshaller // SAX events will be sent to the repeater, and the repeater // will further forward it to an appropriate component. try { marshaller.marshal( contentObject, (XMLFilterImpl)repeater ); } catch( JAXBException e ) { // wrap it to a SAXException SAXParseException se = new SAXParseException( e.getMessage(), null, null, -1, -1, e ); // if the consumer sets an error handler, it is our responsibility // to notify it. if(errorHandler!=null) errorHandler.fatalError(se); // this is a fatal error. Even if the error handler // returns, we will abort anyway. throw se; } }
Example #9
Source File: DOMForest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Returns a {@link ContentHandler} to feed SAX events into. * * <p> * The client of this class can feed SAX events into the handler * to parse a document into this DOM forest. * * This version requires that the DOM object to be created and registered * to the map beforehand. */ private ContentHandler getParserHandler( Document dom ) { ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings); handler = new WhitespaceStripper(handler,errorReceiver,entityResolver); handler = new VersionChecker(handler,errorReceiver,entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if(errorReceiver!=null) f.setErrorHandler(errorReceiver); if(entityResolver!=null) f.setEntityResolver(entityResolver); return f; }
Example #10
Source File: DomHandlerEx.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
ResultImpl() { try { DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); // safe - only used for BI s2d = new SAX2DOMEx(factory); } catch (ParserConfigurationException e) { throw new AssertionError(e); // impossible } XMLFilterImpl f = new XMLFilterImpl() { @Override public void setDocumentLocator(Locator locator) { super.setDocumentLocator(locator); location = new LocatorImpl(locator); } }; f.setContentHandler(s2d); setHandler(f); }
Example #11
Source File: DOMForest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Returns a {@link ContentHandler} to feed SAX events into. * * <p> * The client of this class can feed SAX events into the handler * to parse a document into this DOM forest. * * This version requires that the DOM object to be created and registered * to the map beforehand. */ private ContentHandler getParserHandler( Document dom ) { ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings); handler = new WhitespaceStripper(handler,errorReceiver,entityResolver); handler = new VersionChecker(handler,errorReceiver,entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if(errorReceiver!=null) f.setErrorHandler(errorReceiver); if(entityResolver!=null) f.setEntityResolver(entityResolver); return f; }
Example #12
Source File: TestBeansFilter.java From JVoiceXML with GNU Lesser General Public License v2.1 | 6 votes |
/** * Test method for the filter. * * @exception Exception * test failed */ @Test public void testFilter() throws Exception { final TransformerFactory tf = TransformerFactory.newInstance(); final TransformerHandler th = ((SAXTransformerFactory) tf) .newTransformerHandler(); final ByteArrayOutputStream out = new ByteArrayOutputStream(); final Result result = new StreamResult(out); th.setResult(result); final SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setValidating(false); spf.setNamespaceAware(true); spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true); final SAXParser parser = spf.newSAXParser(); final XMLFilterImpl filter = new BeansFilter(parser.getXMLReader()); filter.setContentHandler(th); final InputStream in = new FileInputStream("../org.jvoicexml.config/src/test/resources/config/test-implementation.xml"); final InputSource input = new InputSource(in); filter.parse(input); final String str = out.toString(); Assert.assertTrue("classpath should be removed", str.indexOf("classpath") < 0); Assert.assertTrue("repository should be removed", str.indexOf("repository") < 0); }
Example #13
Source File: DOMForest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Returns a {@link ContentHandler} to feed SAX events into. * * <p> * The client of this class can feed SAX events into the handler * to parse a document into this DOM forest. * * This version requires that the DOM object to be created and registered * to the map beforehand. */ private ContentHandler getParserHandler( Document dom ) { ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings); handler = new WhitespaceStripper(handler,errorReceiver,entityResolver); handler = new VersionChecker(handler,errorReceiver,entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if(errorReceiver!=null) f.setErrorHandler(errorReceiver); if(entityResolver!=null) f.setEntityResolver(entityResolver); return f; }
Example #14
Source File: JAXBSource.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public void parse() throws SAXException { // parses a content object by using the given marshaller // SAX events will be sent to the repeater, and the repeater // will further forward it to an appropriate component. try { marshaller.marshal( contentObject, (XMLFilterImpl)repeater ); } catch( JAXBException e ) { // wrap it to a SAXException SAXParseException se = new SAXParseException( e.getMessage(), null, null, -1, -1, e ); // if the consumer sets an error handler, it is our responsibility // to notify it. if(errorHandler!=null) errorHandler.fatalError(se); // this is a fatal error. Even if the error handler // returns, we will abort anyway. throw se; } }
Example #15
Source File: JAXBSource.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public void parse() throws SAXException { // parses a content object by using the given marshaller // SAX events will be sent to the repeater, and the repeater // will further forward it to an appropriate component. try { marshaller.marshal( contentObject, (XMLFilterImpl)repeater ); } catch( JAXBException e ) { // wrap it to a SAXException SAXParseException se = new SAXParseException( e.getMessage(), null, null, -1, -1, e ); // if the consumer sets an error handler, it is our responsibility // to notify it. if(errorHandler!=null) errorHandler.fatalError(se); // this is a fatal error. Even if the error handler // returns, we will abort anyway. throw se; } }
Example #16
Source File: DOMForest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Returns a {@link ContentHandler} to feed SAX events into. * * <p> * The client of this class can feed SAX events into the handler * to parse a document into this DOM forest. * * This version requires that the DOM object to be created and registered * to the map beforehand. */ private ContentHandler getParserHandler( Document dom ) { ContentHandler handler = new DOMBuilder(dom,locatorTable,outerMostBindings); handler = new WhitespaceStripper(handler,errorReceiver,entityResolver); handler = new VersionChecker(handler,errorReceiver,entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if(errorReceiver!=null) f.setErrorHandler(errorReceiver); if(entityResolver!=null) f.setEntityResolver(entityResolver); return f; }
Example #17
Source File: Json2XmlValidator.java From iaf with Apache License 2.0 | 6 votes |
protected PipeRunResult alignXml2Json(String messageToValidate, IPipeLineSession session, boolean responseMode) throws XmlValidatorException, PipeRunException, ConfigurationException { ValidationContext context = validator.createValidationContext(session, getJsonRootValidations(responseMode), getInvalidRootNamespaces()); ValidatorHandler validatorHandler = validator.getValidatorHandler(session,context); // Make sure to use Xerces' ValidatorHandlerImpl, otherwise casting below will fail. XmlAligner aligner = new XmlAligner(validatorHandler); Xml2Json xml2json = new Xml2Json(aligner, isCompactJsonArrays(), !isJsonWithRootElements()); XMLFilterImpl handler = xml2json; if (StringUtils.isNotEmpty(getRootElementSessionKey())) { handler = new RootElementToSessionKeyFilter(session, getRootElementSessionKey(), getRootNamespaceSessionKey(), handler); } aligner.setContentHandler(handler); aligner.setErrorHandler(context.getErrorHandler()); String resultEvent= validator.validate(messageToValidate, session, getLogPrefix(session), validatorHandler, xml2json, context); String out=xml2json.toString(); PipeForward forward=determineForward(resultEvent, session, responseMode); PipeRunResult result=new PipeRunResult(forward,out); return result; }
Example #18
Source File: ModelLoader.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Parses a RELAX NG grammar into an annotated grammar. */ private Model loadRELAXNG() throws SAXException { // build DOM forest final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() ); // use JAXP masquerading to validate the input document. // DOMForest -> ExtensionBindingChecker -> RNGOM XMLReaderCreator xrc = new XMLReaderCreator() { public XMLReader createXMLReader() { // foreset parser cannot change the receivers while it's working, // so we need to have one XMLFilter that works as a buffer XMLFilter buffer = new XMLFilterImpl() { @Override public void parse(InputSource source) throws IOException, SAXException { forest.createParser().parse( source, this, this, this ); } }; XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver); f.setParent(buffer); f.setEntityResolver(opt.entityResolver); return f; } }; Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc ); return loadRELAXNG(p); }
Example #19
Source File: XMLFilterTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * By default false is expected get namespaces-prefix feature. * * @throws Exception If any errors occur. */ @Test public void getFeature02() throws Exception { SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setNamespaceAware(true); XMLFilterImpl xmlFilter = new XMLFilterImpl(); xmlFilter.setParent(spf.newSAXParser().getXMLReader()); assertFalse(xmlFilter.getFeature(NAMESPACE_PREFIXES)); }
Example #20
Source File: DOMForest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns a {@link org.xml.sax.XMLReader} to parse a document into this DOM forest. * <p/> * This version requires that the DOM object to be created and registered * to the map beforehand. */ private XMLReader createReader(Document dom) throws SAXException, ParserConfigurationException { XMLReader reader = parserFactory.newSAXParser().getXMLReader(); DOMBuilder dombuilder = new DOMBuilder(dom, locatorTable, outerMostBindings); try { reader.setProperty("http://xml.org/sax/properties/lexical-handler", dombuilder); } catch(SAXException e) { errorReceiver.debug(e.getMessage()); } ContentHandler handler = new WhitespaceStripper(dombuilder, errorReceiver, entityResolver); handler = new VersionChecker(handler, errorReceiver, entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if (errorReceiver != null) f.setErrorHandler(errorReceiver); f.setEntityResolver(entityResolver); reader.setContentHandler(f); if (errorReceiver != null) reader.setErrorHandler(errorReceiver); reader.setEntityResolver(entityResolver); return reader; }
Example #21
Source File: ParserAdapterTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Verifies parserAdapter.getEntityResolver() */ @Test public void entity01() { XMLFilterImpl xmlFilter = new XMLFilterImpl(); parserAdapter.setEntityResolver(xmlFilter); assertNotNull(parserAdapter.getEntityResolver()); }
Example #22
Source File: ModelLoader.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Parses a RELAX NG grammar into an annotated grammar. */ private Model loadRELAXNG() throws SAXException { // build DOM forest final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() ); // use JAXP masquerading to validate the input document. // DOMForest -> ExtensionBindingChecker -> RNGOM XMLReaderCreator xrc = new XMLReaderCreator() { public XMLReader createXMLReader() { // foreset parser cannot change the receivers while it's working, // so we need to have one XMLFilter that works as a buffer XMLFilter buffer = new XMLFilterImpl() { @Override public void parse(InputSource source) throws IOException, SAXException { forest.createParser().parse( source, this, this, this ); } }; XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver); f.setParent(buffer); f.setEntityResolver(opt.entityResolver); return f; } }; Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc ); return loadRELAXNG(p); }
Example #23
Source File: DOMForest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Returns a {@link org.xml.sax.XMLReader} to parse a document into this DOM forest. * <p/> * This version requires that the DOM object to be created and registered * to the map beforehand. */ private XMLReader createReader(Document dom) throws SAXException, ParserConfigurationException { XMLReader reader = parserFactory.newSAXParser().getXMLReader(); DOMBuilder dombuilder = new DOMBuilder(dom, locatorTable, outerMostBindings); try { reader.setProperty("http://xml.org/sax/properties/lexical-handler", dombuilder); } catch(SAXException e) { errorReceiver.debug(e.getMessage()); } ContentHandler handler = new WhitespaceStripper(dombuilder, errorReceiver, entityResolver); handler = new VersionChecker(handler, errorReceiver, entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if (errorReceiver != null) f.setErrorHandler(errorReceiver); f.setEntityResolver(entityResolver); reader.setContentHandler(f); if (errorReceiver != null) reader.setErrorHandler(errorReceiver); reader.setEntityResolver(entityResolver); return reader; }
Example #24
Source File: SkipEmptyTagsFilterTest.java From iaf with Apache License 2.0 | 5 votes |
public void testXmlWriter(XMLFilterImpl filter, String input, String expected) throws IOException, SAXException { XmlWriter xmlWriter = new XmlWriter(); PrettyPrintFilter ppf = new PrefixMappingObservingFilter(xmlWriter); ppf.setIndent(""); filter.setContentHandler(ppf); XmlUtils.parseXml(input, filter); assertEquals(expected,xmlWriter.toString()); }
Example #25
Source File: XMLFilterTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * No exception expected when set a correct entity solver. */ @Test public void entity01() { XMLFilterImpl xmlFilter = new XMLFilterImpl(); xmlFilter.setEntityResolver(xmlFilter); assertNotNull(xmlFilter.getEntityResolver()); }
Example #26
Source File: ParserAdapterTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Verifies parserAdapter.getDTDHandler() */ @Test public void dtdHandler01() { XMLFilterImpl xmlFilter = new XMLFilterImpl(); parserAdapter.setDTDHandler(xmlFilter); assertNotNull(parserAdapter.getDTDHandler()); }
Example #27
Source File: ModelLoader.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Parses a RELAX NG grammar into an annotated grammar. */ private Model loadRELAXNG() throws SAXException { // build DOM forest final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() ); // use JAXP masquerading to validate the input document. // DOMForest -> ExtensionBindingChecker -> RNGOM XMLReaderCreator xrc = new XMLReaderCreator() { public XMLReader createXMLReader() { // foreset parser cannot change the receivers while it's working, // so we need to have one XMLFilter that works as a buffer XMLFilter buffer = new XMLFilterImpl() { @Override public void parse(InputSource source) throws IOException, SAXException { forest.createParser().parse( source, this, this, this ); } }; XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver); f.setParent(buffer); f.setEntityResolver(opt.entityResolver); return f; } }; Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc ); return loadRELAXNG(p); }
Example #28
Source File: ModelLoader.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Parses a RELAX NG grammar into an annotated grammar. */ private Model loadRELAXNG() throws SAXException { // build DOM forest final DOMForest forest = buildDOMForest( new RELAXNGInternalizationLogic() ); // use JAXP masquerading to validate the input document. // DOMForest -> ExtensionBindingChecker -> RNGOM XMLReaderCreator xrc = new XMLReaderCreator() { public XMLReader createXMLReader() { // foreset parser cannot change the receivers while it's working, // so we need to have one XMLFilter that works as a buffer XMLFilter buffer = new XMLFilterImpl() { @Override public void parse(InputSource source) throws IOException, SAXException { forest.createParser().parse( source, this, this, this ); } }; XMLFilter f = new ExtensionBindingChecker(Const.RELAXNG_URI,opt,errorReceiver); f.setParent(buffer); f.setEntityResolver(opt.entityResolver); return f; } }; Parseable p = new SAXParseable( opt.getGrammars()[0], errorReceiver, xrc ); return loadRELAXNG(p); }
Example #29
Source File: DOMForest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns a {@link org.xml.sax.XMLReader} to parse a document into this DOM forest. * <p/> * This version requires that the DOM object to be created and registered * to the map beforehand. */ private XMLReader createReader(Document dom) throws SAXException, ParserConfigurationException { XMLReader reader = parserFactory.newSAXParser().getXMLReader(); DOMBuilder dombuilder = new DOMBuilder(dom, locatorTable, outerMostBindings); try { reader.setProperty("http://xml.org/sax/properties/lexical-handler", dombuilder); } catch(SAXException e) { errorReceiver.debug(e.getMessage()); } ContentHandler handler = new WhitespaceStripper(dombuilder, errorReceiver, entityResolver); handler = new VersionChecker(handler, errorReceiver, entityResolver); // insert the reference finder so that // included/imported schemas will be also parsed XMLFilterImpl f = logic.createExternalReferenceFinder(this); f.setContentHandler(handler); if (errorReceiver != null) f.setErrorHandler(errorReceiver); f.setEntityResolver(entityResolver); reader.setContentHandler(f); if (errorReceiver != null) reader.setErrorHandler(errorReceiver); reader.setEntityResolver(entityResolver); return reader; }
Example #30
Source File: ParserAdapterTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Verifies parserAdapter.getContentHandler() */ @Test public void contentHandler01() { ContentHandler contentHandler = new XMLFilterImpl(); parserAdapter.setContentHandler(contentHandler); assertNotNull(parserAdapter.getContentHandler()); }