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


Java Parser.setDTDHandler方法代码示例

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


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

示例1: parse

import org.xml.sax.Parser; //导入方法依赖的package包/类
/**
 * Parse the specified input source, reporting SAX1 events to the
 * given handler.
 * Prefer the SAX2 version of this method, since the HandlerBase class is
 * now deprecated.
 * @param is the SAX input source
 * @param hb the SAX1 handler
 * @exception IllegalArgumentException if the input source is null
 * @see #parse(org.xml.sax.InputSource,org.xml.sax.helpers.DefaultHandler)
 */
public void parse(InputSource is, HandlerBase hb)
  throws SAXException, IOException
{
  if (is == null)
    {
      throw new IllegalArgumentException("input source is null");
    }
  Parser parser = getParser();
  parser.setDocumentHandler(hb);
  parser.setDTDHandler(hb);
  parser.setEntityResolver(hb);
  parser.setErrorHandler(hb);
  parser.parse(is);
}
 
开发者ID:vilie,项目名称:javify,代码行数:25,代码来源:SAXParser.java

示例2: parse

import org.xml.sax.Parser; //导入方法依赖的package包/类
/**
 * Parse the specified input source, reporting SAX1 events to the
 * given handler.
 * Prefer the SAX2 version of this method, since the HandlerBase class is
 * now deprecated.
 * @param is the SAX input source
 * @param hb the SAX1 handler
 * @exception IllegalArgumentException if the input source is null
 * @see #parse(org.xml.sax.InputSource,org.xml.sax.helpers.DefaultHandler)
 */
public void parse(InputSource is, HandlerBase hb) 
  throws SAXException, IOException
{
  if (is == null)
    {
      throw new IllegalArgumentException("input source is null");
    }
  Parser parser = getParser();
  parser.setDocumentHandler(hb);
  parser.setDTDHandler(hb);
  parser.setEntityResolver(hb);
  parser.setErrorHandler(hb);
  parser.parse(is);
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:25,代码来源:SAXParser.java

示例3: parse

import org.xml.sax.Parser; //导入方法依赖的package包/类
/**
 * Parse the content given {@link org.xml.sax.InputSource}
 * as XML using the specified
 * {@link org.xml.sax.HandlerBase}.
 * <i> Use of the DefaultHandler version of this method is recommended as
 * the HandlerBase class has been deprecated in SAX 2.0</i>
 *
 * @param is The InputSource containing the content to be parsed.
 * @param hb The SAX HandlerBase 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, HandlerBase hb)
    throws SAXException, IOException {
    if (is == null) {
        throw new IllegalArgumentException("InputSource cannot be null");
    }

    Parser parser = this.getParser();
    if (hb != null) {
        parser.setDocumentHandler(hb);
        parser.setEntityResolver(hb);
        parser.setErrorHandler(hb);
        parser.setDTDHandler(hb);
    }
    parser.parse(is);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:SAXParser.java


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