本文整理汇总了Java中org.xml.sax.helpers.XMLFilterImpl.setEntityResolver方法的典型用法代码示例。如果您正苦于以下问题:Java XMLFilterImpl.setEntityResolver方法的具体用法?Java XMLFilterImpl.setEntityResolver怎么用?Java XMLFilterImpl.setEntityResolver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.xml.sax.helpers.XMLFilterImpl
的用法示例。
在下文中一共展示了XMLFilterImpl.setEntityResolver方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getParserHandler
import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
/**
* 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;
}
示例2: createReader
import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
/**
* 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;
}
示例3: entity01
import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
/**
* No exception expected when set a correct entity solver.
*/
@Test
public void entity01() {
XMLFilterImpl xmlFilter = new XMLFilterImpl();
xmlFilter.setEntityResolver(xmlFilter);
assertNotNull(xmlFilter.getEntityResolver());
}