本文整理汇总了Java中org.apache.jasper.xmlparser.TreeNode.findAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java TreeNode.findAttribute方法的具体用法?Java TreeNode.findAttribute怎么用?Java TreeNode.findAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jasper.xmlparser.TreeNode
的用法示例。
在下文中一共展示了TreeNode.findAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVersion
import org.apache.jasper.xmlparser.TreeNode; //导入方法依赖的package包/类
private double getVersion(TreeNode webApp) {
String v = webApp.findAttribute("version");
if (v != null) {
try {
return Double.parseDouble(v);
} catch (NumberFormatException e) {
}
}
return 2.3;
}
示例2: getVersion
import org.apache.jasper.xmlparser.TreeNode; //导入方法依赖的package包/类
private double getVersion(TreeNode webApp) {
String v = webApp.findAttribute("version");
if (v != null) {
try {
return Double.parseDouble(v);
} catch (NumberFormatException e) {
}
}
return 2.3;
}
示例3: parseImplicitTld
import org.apache.jasper.xmlparser.TreeNode; //导入方法依赖的package包/类
/**
* Parses the JSP version and tlib-version from the implicit.tld at the
* given path.
*/
private void parseImplicitTld(JspCompilationContext ctxt, String path)
throws JasperException {
InputStream is = null;
TreeNode tld = null;
try {
URL uri = ctxt.getResource(path);
if (uri == null) {
// no implicit.tld
return;
}
is = uri.openStream();
/* SJSAS 6384538
tld = new ParserUtils().parseXMLDocument(IMPLICIT_TLD, is);
*/
// START SJSAS 6384538
tld = new ParserUtils().parseXMLDocument(
IMPLICIT_TLD, is, ctxt.getOptions().isValidationEnabled());
// END SJSAS 6384538
} catch (Exception ex) {
throw new JasperException(ex);
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable t) {}
}
}
this.jspversion = tld.findAttribute("version");
Iterator list = tld.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
if ("tlibversion".equals(tname)
|| "tlib-version".equals(tname)) {
this.tlibversion = element.getBody();
} else if ("jspversion".equals(tname)
|| "jsp-version".equals(tname)) {
this.jspversion = element.getBody();
} else if (!"shortname".equals(tname)
&& !"short-name".equals(tname)) {
err.jspError("jsp.error.implicitTld.additionalElements",
path, tname);
}
}
// JSP version in implicit.tld must be 2.0 or greater
Double jspVersionDouble = Double.valueOf(this.jspversion);
if (Double.compare(jspVersionDouble, Constants.JSP_VERSION_2_0) < 0) {
err.jspError("jsp.error.implicitTld.jspVersion", path,
this.jspversion);
}
}
示例4: parseImplicitTld
import org.apache.jasper.xmlparser.TreeNode; //导入方法依赖的package包/类
/**
* Parses the JSP version and tlib-version from the implicit.tld at the
* given path.
*/
private void parseImplicitTld(JspCompilationContext ctxt, String path)
throws JasperException {
InputStream is = null;
TreeNode tld = null;
try {
URL uri = ctxt.getResource(path);
if (uri == null) {
// no implicit.tld
return;
}
is = uri.openStream();
/* SJSAS 6384538
tld = new ParserUtils().parseXMLDocument(IMPLICIT_TLD, is);
*/
// START SJSAS 6384538
boolean blockExternal = Boolean.parseBoolean(ctxt.getServletContext()
.getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM));
tld = new ParserUtils(blockExternal).parseXMLDocument(
IMPLICIT_TLD, is, ctxt.getOptions().isValidationEnabled());
// END SJSAS 6384538
} catch (Exception ex) {
throw new JasperException(ex);
} finally {
if (is != null) {
try {
is.close();
} catch (Throwable t) {}
}
}
this.jspversion = tld.findAttribute("version");
Iterator list = tld.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
if ("tlibversion".equals(tname)
|| "tlib-version".equals(tname)) {
this.tlibversion = element.getBody();
} else if ("jspversion".equals(tname)
|| "jsp-version".equals(tname)) {
this.jspversion = element.getBody();
} else if (!"shortname".equals(tname)
&& !"short-name".equals(tname)) {
err.jspError("jsp.error.implicitTld.additionalElements",
path, tname);
}
}
// JSP version in implicit.tld must be 2.0 or greater
Double jspVersionDouble = Double.valueOf(this.jspversion);
if (Double.compare(jspVersionDouble, Constants.JSP_VERSION_2_0) < 0) {
err.jspError("jsp.error.implicitTld.jspVersion", path,
this.jspversion);
}
}