gpt4 book ai didi

org.cyberneko.html.xercesbridge.XercesBridge.getVersion()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-19 22:40:40 26 4
gpt4 key购买 nike

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

XercesBridge.getVersion介绍

[英]Gets the Xerces version used
[中]获取使用的Xerces版本

代码示例

代码示例来源:origin: net.sourceforge.nekohtml/nekohtml

/** Returns the parser's sub-version number. */
private static int getParserSubVersion() {
  try {
    String VERSION = XercesBridge.getInstance().getVersion();
    int index1 = VERSION.indexOf('.') + 1;
    int index2 = VERSION.indexOf('.', index1);
    if (index2 == -1) { index2 = VERSION.length(); }
    return Integer.parseInt(VERSION.substring(index1, index2));
  }
  catch (Exception e) {
    return -1;
  }
} // getParserSubVersion():int

代码示例来源:origin: net.sourceforge.nekohtml/com.springsource.org.cyberneko.html

/** Returns the parser's sub-version number. */
private static int getParserSubVersion() {
  try {
    String VERSION = XercesBridge.getInstance().getVersion();
    int index1 = VERSION.indexOf('.') + 1;
    int index2 = VERSION.indexOf('.', index1);
    if (index2 == -1) { index2 = VERSION.length(); }
    return Integer.parseInt(VERSION.substring(index1, index2));
  }
  catch (Exception e) {
    return -1;
  }
} // getParserSubVersion():int

代码示例来源:origin: net.sourceforge.nekohtml/nekohtml

/** Doctype declaration. */
public void doctypeDecl(String root, String pubid, String sysid,
            Augmentations augs) throws XNIException {
  
  // NOTE: Xerces HTML DOM implementation (up to and including
  //       2.5.0) throws a heirarchy request error exception 
  //       when a doctype node is appended to the tree. So, 
  //       don't insert this node into the tree for those 
  //       versions... -Ac
  String VERSION = XercesBridge.getInstance().getVersion();
  boolean okay = true;
  if (VERSION.startsWith("Xerces-J 2.")) {
    okay = getParserSubVersion() > 5;
  }
  // REVISIT: As soon as XML4J is updated with the latest code
  //          from Xerces, then this needs to be updated to
  //          check XML4J's version. -Ac
  else if (VERSION.startsWith("XML4J")) {
    okay = false;
  }
  // if okay, insert doctype; otherwise, don't risk it
  if (okay) {
    super.doctypeDecl(root, pubid, sysid, augs);
  }
} // doctypeDecl(String,String,String,Augmentations)

代码示例来源:origin: net.sourceforge.nekohtml/com.springsource.org.cyberneko.html

/** Doctype declaration. */
public void doctypeDecl(String root, String pubid, String sysid,
            Augmentations augs) throws XNIException {
  
  // NOTE: Xerces HTML DOM implementation (up to and including
  //       2.5.0) throws a heirarchy request error exception 
  //       when a doctype node is appended to the tree. So, 
  //       don't insert this node into the tree for those 
  //       versions... -Ac
  String VERSION = XercesBridge.getInstance().getVersion();
  boolean okay = true;
  if (VERSION.startsWith("Xerces-J 2.")) {
    okay = getParserSubVersion() > 5;
  }
  // REVISIT: As soon as XML4J is updated with the latest code
  //          from Xerces, then this needs to be updated to
  //          check XML4J's version. -Ac
  else if (VERSION.startsWith("XML4J")) {
    okay = false;
  }
  // if okay, insert doctype; otherwise, don't risk it
  if (okay) {
    super.doctypeDecl(root, pubid, sysid, augs);
  }
} // doctypeDecl(String,String,String,Augmentations)

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com