當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLFilterImpl類代碼示例

本文整理匯總了Java中org.xml.sax.helpers.XMLFilterImpl的典型用法代碼示例。如果您正苦於以下問題:Java XMLFilterImpl類的具體用法?Java XMLFilterImpl怎麽用?Java XMLFilterImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


XMLFilterImpl類屬於org.xml.sax.helpers包,在下文中一共展示了XMLFilterImpl類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: parse

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
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;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:JAXBSource.java

示例4: setFeature01

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
/**
 * Set namespaces feature to a value to XMLFilter. it's expected same when
 * obtain it again.
 *
 * @throws Exception If any errors occur.
 */
@Test
public void setFeature01() throws Exception {
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);

    XMLFilterImpl xmlFilter = new XMLFilterImpl();
    xmlFilter.setParent(spf.newSAXParser().getXMLReader());
    xmlFilter.setFeature(NAMESPACES, false);
    assertFalse(xmlFilter.getFeature(NAMESPACES));
    xmlFilter.setFeature(NAMESPACES, true);
    assertTrue(xmlFilter.getFeature(NAMESPACES));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:XMLFilterTest.java

示例5: parse

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
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;
    }
}
 
開發者ID:cuba-platform,項目名稱:yarg,代碼行數:23,代碼來源:XmlCopyUtils.java

示例6: 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

示例7: 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

示例8: 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

示例9: loadRELAXNG

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
/**
 * 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);

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:38,代碼來源:ModelLoader.java

示例10: 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

示例11: 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());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:XMLFilterTest.java

示例12: dtdHandler01

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
/**
 * No exception expected when set a correct DTD handler.
 */
@Test
public void dtdHandler01() {
    XMLFilterImpl xmlFilter = new XMLFilterImpl();
    xmlFilter.setDTDHandler(xmlFilter);
    assertNotNull(xmlFilter.getDTDHandler());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:XMLFilterTest.java

示例13: errorHandler01

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
/**
 * No exception expected when set a correct error handler.
 */
@Test
public void errorHandler01() {
    XMLFilterImpl xmlFilter = new XMLFilterImpl();
    xmlFilter.setErrorHandler(xmlFilter);
    assertNotNull(xmlFilter.getErrorHandler());
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:10,代碼來源:XMLFilterTest.java

示例14: getFeature01

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
/**
 * By default true is expected get namespaces feature.
 *
 * @throws Exception If any errors occur.
 */
@Test
public void getFeature01() throws Exception {
    SAXParserFactory spf = SAXParserFactory.newInstance();
    spf.setNamespaceAware(true);
    XMLReader xmlReader = spf.newSAXParser().getXMLReader();

    XMLFilterImpl xmlFilter = new XMLFilterImpl();
    xmlFilter.setParent(xmlReader);
    assertTrue(xmlFilter.getFeature(NAMESPACES));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:16,代碼來源:XMLFilterTest.java

示例15: getFeature02

import org.xml.sax.helpers.XMLFilterImpl; //導入依賴的package包/類
/**
 * 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));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:14,代碼來源:XMLFilterTest.java


注:本文中的org.xml.sax.helpers.XMLFilterImpl類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。