当前位置: 首页>>代码示例>>Java>>正文


Java XMLFilterImpl.setContentHandler方法代码示例

本文整理汇总了Java中org.xml.sax.helpers.XMLFilterImpl.setContentHandler方法的典型用法代码示例。如果您正苦于以下问题:Java XMLFilterImpl.setContentHandler方法的具体用法?Java XMLFilterImpl.setContentHandler怎么用?Java XMLFilterImpl.setContentHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.xml.sax.helpers.XMLFilterImpl的用法示例。


在下文中一共展示了XMLFilterImpl.setContentHandler方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ResultImpl

import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:DomHandlerEx.java

示例2: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:DOMForest.java

示例3: ResultImpl

import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
ResultImpl() {
    try {
        s2d = new SAX2DOMEx();
    } catch (ParserConfigurationException e) {
        throw new AssertionError(e);    // impossible
    }

    XMLFilterImpl f = new XMLFilterImpl() {
        public void setDocumentLocator(Locator locator) {
            super.setDocumentLocator(locator);
            location = new LocatorImpl(locator);
        }
    };
    f.setContentHandler(s2d);

    setHandler(f);
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:18,代码来源:DomHandlerEx.java

示例4: validate

import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
public String validate(Object input, IPipeLineSession session, String logPrefix, XMLReader parser, XMLFilterImpl filter, ValidationContext context) throws XmlValidatorException, PipeRunException, ConfigurationException {

		if (filter!=null) {
			filter.setContentHandler(context.getContentHandler());
			filter.setErrorHandler(context.getErrorHandler());
		} else {
			parser.setContentHandler(context.getContentHandler());
			parser.setErrorHandler(context.getErrorHandler());
		}
		
		InputSource is = getInputSource(input);
		
		try {
			parser.parse(is);
		} catch (Exception e) {
			return finalizeValidation(context, session, e);
		}
		return finalizeValidation(context, session, null);
	}
 
开发者ID:ibissource,项目名称:iaf,代码行数:20,代码来源:AbstractXmlValidator.java

示例5: 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:DOMForest.java

示例6: contentHandler01

import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
/**
 * No exception expected when set a correct content handler.
 */
@Test
public void contentHandler01() {
    XMLFilterImpl xmlFilter = new XMLFilterImpl();
    xmlFilter.setContentHandler(xmlFilter);
    assertNotNull(xmlFilter.getContentHandler());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:XMLFilterTest.java

示例7: getFilteredXMLReader

import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
private XMLReader getFilteredXMLReader() throws SAXException {
  if (this.xmlReader == null) {
    XMLFilterImpl filter = new BodyFilter();
    filter.setContentHandler(new ContentHandlerToXMLStreamWriter(xsw));           
    this.xmlReader = XMLReaderFactory.createXMLReader();              
    this.xmlReader.setFeature("http://xml.org/sax/features/validation", false);
    this.xmlReader.setFeature("http://xml.org/sax/features/namespaces", true);
    this.xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);            
    if (Context.getInstance().getParserHardening()) {
      setXMLReaderFeature(this.xmlReader, "http://xml.org/sax/features/external-general-entities", false);
      setXMLReaderFeature(this.xmlReader, "http://xml.org/sax/features/external-parameter-entities", false);
      setXMLReaderFeature(this.xmlReader, "http://apache.org/xml/features/disallow-doctype-decl", true);
      setXMLReaderFeature(this.xmlReader, "http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
      this.xmlReader.setEntityResolver(new EntityResolver() {
        @Override
        public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {            
          return null;
        }         
      });
      if (SECURITY_MANAGER != null) {
        setXMLReaderProperty(this.xmlReader, "http://apache.org/xml/properties/security-manager", SECURITY_MANAGER);
      }
    }            
    this.xmlReader.setContentHandler(filter);      
  }
  return this.xmlReader;
}
 
开发者ID:Armatiek,项目名称:xslweb,代码行数:28,代码来源:RequestSerializer.java

示例8: wrapBy

import org.xml.sax.helpers.XMLFilterImpl; //导入方法依赖的package包/类
/**
 * Wraps the specified content handler by a filter.
 * It is little awkward to use a helper implementation class like XMLFilterImpl
 * as the method parameter, but this simplifies the code.
 */
private ContentHandler wrapBy( XMLFilterImpl filter, ContentHandler handler ) {
    filter.setContentHandler(handler);
    return filter;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:ModelLoader.java


注:本文中的org.xml.sax.helpers.XMLFilterImpl.setContentHandler方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。