org.xml.sax.Parser.setDTDHandler()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.xml.sax.Parser.setDTDHandler()方法的一些代码示例,展示了Parser.setDTDHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.setDTDHandler()方法的具体详情如下:
包路径:org.xml.sax.Parser
类名称:Parser
方法名:setDTDHandler

Parser.setDTDHandler介绍

[英]Allow an application to register a DTD event handler.

If the application does not register a DTD handler, all DTD events reported by the SAX parser will be silently ignored (this is the default behaviour implemented by HandlerBase).

Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
[中]允许应用程序注册DTD事件处理程序。
如果应用程序没有注册DTD处理程序,SAX解析器报告的所有DTD事件都将被静默忽略(这是HandlerBase实现的默认行为)。
应用程序可以在解析过程中登记新的或不同的处理程序,SAX解析器必须立即使用新的处理程序。

代码示例

代码示例来源:origin: org.apache.ant/ant

parser.setEntityResolver(hb);
  parser.setErrorHandler(hb);
  parser.setDTDHandler(hb);
  parser.parse(inputSource);
} catch (SAXParseException exc) {

代码示例来源:origin: robovm/robovm

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: robovm/robovm

parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);

代码示例来源:origin: sun-jaxb/jaxb-xjc

/** Setup for parsing. */
private void setupParse(String systemId) {
 allowXMLCatalogPI = true;
 parser.setEntityResolver(this);
 parser.setDocumentHandler(this);
 parser.setDTDHandler(this);
 URL cwd = null;
 try {
  cwd = FileURL.makeURL("basename");
 } catch (MalformedURLException mue) {
  cwd = null;
 }
 try {
  baseURL = new URL(systemId);
 } catch (MalformedURLException mue) {
  if (cwd != null) {
 try {
  baseURL = new URL(cwd, systemId);
 } catch (MalformedURLException mue2) {
  // give up
  baseURL = null;
 }
  } else {
 // give up
 baseURL = null;
  }
 }
}

代码示例来源:origin: xml-resolver/xml-resolver

/** Setup for parsing. */
private void setupParse(String systemId) {
 allowXMLCatalogPI = true;
 parser.setEntityResolver(this);
 parser.setDocumentHandler(this);
 parser.setDTDHandler(this);
 URL cwd = null;
 try {
  cwd = FileURL.makeURL("basename");
 } catch (MalformedURLException mue) {
  cwd = null;
 }
 try {
  baseURL = new URL(systemId);
 } catch (MalformedURLException mue) {
  if (cwd != null) {
 try {
  baseURL = new URL(cwd, systemId);
 } catch (MalformedURLException mue2) {
  // give up
  baseURL = null;
 }
  } else {
 // give up
 baseURL = null;
  }
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xmlresolver

/** Setup for parsing. */
private void setupParse(String systemId) {
 allowXMLCatalogPI = true;
 parser.setEntityResolver(this);
 parser.setDocumentHandler(this);
 parser.setDTDHandler(this);
 URL cwd = null;
 try {
  cwd = FileURL.makeURL("basename");
 } catch (MalformedURLException mue) {
  cwd = null;
 }
 try {
  baseURL = new URL(systemId);
 } catch (MalformedURLException mue) {
  if (cwd != null) {
 try {
  baseURL = new URL(cwd, systemId);
 } catch (MalformedURLException mue2) {
  // give up
  baseURL = null;
 }
  } else {
 // give up
 baseURL = null;
  }
 }
}

代码示例来源:origin: org.apache.xml/com.springsource.org.apache.xml.resolver

/** Setup for parsing. */
private void setupParse(String systemId) {
 allowXMLCatalogPI = true;
 parser.setEntityResolver(this);
 parser.setDocumentHandler(this);
 parser.setDTDHandler(this);
 URL cwd = null;
 try {
  cwd = FileURL.makeURL("basename");
 } catch (MalformedURLException mue) {
  cwd = null;
 }
 try {
  baseURL = new URL(systemId);
 } catch (MalformedURLException mue) {
  if (cwd != null) {
 try {
  baseURL = new URL(cwd, systemId);
 } catch (MalformedURLException mue2) {
  // give up
  baseURL = null;
 }
  } else {
 // give up
 baseURL = null;
  }
 }
}

代码示例来源:origin: com.sun.xml.parsers/jaxp-ri

/** Setup for parsing. */
private void setupParse(String systemId) {
 allowXMLCatalogPI = true;
 parser.setEntityResolver(this);
 parser.setDocumentHandler(this);
 parser.setDTDHandler(this);
 URL cwd = null;
 try {
  cwd = FileURL.makeURL("basename");
 } catch (MalformedURLException mue) {
  cwd = null;
 }
 try {
  baseURL = new URL(systemId);
 } catch (MalformedURLException mue) {
  if (cwd != null) {
 try {
  baseURL = new URL(cwd, systemId);
 } catch (MalformedURLException mue2) {
  // give up
  baseURL = null;
 }
  } else {
 // give up
 baseURL = null;
  }
 }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: javax.xml.parsers/jaxp-api

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: MobiVM/robovm

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Initialize the parser before each run.
 */
private void setupParser ()
{
// catch an illegal "nonsense" state.
if (!prefixes && !namespaces)
  throw new IllegalStateException ();
nsSupport.reset();
if (uris)
  nsSupport.setNamespaceDeclUris (true);
if (entityResolver != null) {
  parser.setEntityResolver(entityResolver);
}
if (dtdHandler != null) {
  parser.setDTDHandler(dtdHandler);
}
if (errorHandler != null) {
  parser.setErrorHandler(errorHandler);
}
parser.setDocumentHandler(this);
locator = null;
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);

代码示例来源:origin: javax.xml.parsers/jaxp-api

parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);

代码示例来源:origin: com.bugvm/bugvm-rt

parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);

代码示例来源:origin: MobiVM/robovm

parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);

代码示例来源:origin: ibinti/bugvm

parser.setEntityResolver(hb);
parser.setErrorHandler(hb);
parser.setDTDHandler(hb);

相关文章