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


Java DefaultHandler类代码示例

本文整理汇总了Java中jdk.internal.org.xml.sax.helpers.DefaultHandler的典型用法代码示例。如果您正苦于以下问题:Java DefaultHandler类的具体用法?Java DefaultHandler怎么用?Java DefaultHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultHandler类属于jdk.internal.org.xml.sax.helpers包,在下文中一共展示了DefaultHandler类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import jdk.internal.org.xml.sax.helpers.DefaultHandler; //导入依赖的package包/类
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.helpers.DefaultHandler}.
 *
 * @param is The InputSource containing the content to be parsed.
 * @param dh The SAX DefaultHandler to use.
 *
 * @throws IllegalArgumentException If the <code>InputSource</code> object
 *   is <code>null</code>.
 * @throws IOException If any IO errors occur.
 * @throws SAXException If any SAX errors occur during processing.
 *
 * @see org.xml.sax.DocumentHandler
 */
public void parse(InputSource is, DefaultHandler dh)
    throws SAXException, IOException
{
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    XMLReader reader = this.getXMLReader();
    if (dh != null) {
        reader.setContentHandler(dh);
        reader.setEntityResolver(dh);
        reader.setErrorHandler(dh);
        reader.setDTDHandler(dh);
    }
    reader.parse(is);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:32,代码来源:SAXParser.java

示例2: ParserSAX

import jdk.internal.org.xml.sax.helpers.DefaultHandler; //导入依赖的package包/类
/**
 * Constructor.
 */
public ParserSAX() {
    super();

    //              SAX feature defaut values
    mFNamespaces = true;
    mFPrefixes = false;

    //              Default handler which will be used in case the application
    //              do not set one of handlers.
    mHand = new DefaultHandler();
    mHandCont = mHand;
    mHandDtd = mHand;
    mHandErr = mHand;
    mHandEnt = mHand;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:ParserSAX.java

示例3: parse

import jdk.internal.org.xml.sax.helpers.DefaultHandler; //导入依赖的package包/类
/**
 * Parse the content given {@link org.xml.sax.InputSource} as XML using the
 * specified {@link org.xml.sax.helpers.DefaultHandler}.
 *
 * @param is The InputSource containing the content to be parsed.
 * @param handler The SAX DefaultHandler to use.
 * @exception IOException If any IO errors occur.
 * @exception IllegalArgumentException If the InputSource or handler is
 * null.
 * @exception SAXException If the underlying parser throws a SAXException
 * while parsing.
 * @see org.xml.sax.helpers.DefaultHandler
 */
public void parse(InputSource is, DefaultHandler handler)
    throws SAXException, IOException
{
    if ((is == null) || (handler == null)) {
        throw new IllegalArgumentException("");
    }
    //              Set up the handler
    mHandCont = handler;
    mHandDtd = handler;
    mHandErr = handler;
    mHandEnt = handler;
    //              Set up the document
    mInp = new Input(BUFFSIZE_READER);
    mPh = PH_BEFORE_DOC;  // before parsing
    try {
        setinp(is);
    } catch (SAXException | IOException | RuntimeException saxe) {
        throw saxe;
    } catch (Exception e) {
        panic(e.toString());
    }
    parse();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:ParserSAX.java


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