本文整理汇总了Java中org.apache.jasper.xmlparser.TreeNode类的典型用法代码示例。如果您正苦于以下问题:Java TreeNode类的具体用法?Java TreeNode怎么用?Java TreeNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeNode类属于org.apache.jasper.xmlparser包,在下文中一共展示了TreeNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInitParam
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
String[] createInitParam(TreeNode elem) {
String[] initParam = new String[2];
Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = list.next();
String tname = element.getName();
if ("param-name".equals(tname)) {
initParam[0] = element.getBody();
} else if ("param-value".equals(tname)) {
initParam[1] = element.getBody();
} else if ("description".equals(tname)) {
// Do nothing
} else {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage(
"jsp.warning.unknown.element.in.initParam", tname));
}
}
}
return initParam;
}
示例2: createInitParam
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
String[] createInitParam(TreeNode elem) {
String[] initParam = new String[2];
Iterator list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
if ("param-name".equals(tname)) {
initParam[0] = element.getBody();
} else if ("param-value".equals(tname)) {
initParam[1] = element.getBody();
} else if ("description".equals(tname)) {
; // Do nothing
} else {
log.warn(Localizer.getMessage(
"jsp.warning.unknown.element.in.initParam", tname));
}
}
return initParam;
}
示例3: createInitParam
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
String[] createInitParam(TreeNode elem) {
String[] initParam = new String[2];
Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = list.next();
String tname = element.getName();
if ("param-name".equals(tname)) {
initParam[0] = element.getBody();
} else if ("param-value".equals(tname)) {
initParam[1] = element.getBody();
} else if ("description".equals(tname)) {
// Do nothing
} else {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.initParam", tname));
}
}
}
return initParam;
}
示例4: createInitParam
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
private String[] createInitParam(TreeNode elem) throws JasperException {
String[] initParam = new String[2];
Iterator list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
if ("param-name".equals(tname)) {
initParam[0] = element.getBody();
} else if ("param-value".equals(tname)) {
initParam[1] = element.getBody();
} else if ("description".equals(tname)) {
; // Do nothing
} else {
err.jspError("jsp.error.unknown.element.in.initParam",
tname);
}
}
return initParam;
}
示例5: 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;
}
示例6: createFunctionInfo
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
FunctionInfo createFunctionInfo(TreeNode elem) {
String name = null;
String klass = null;
String signature = null;
Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = list.next();
String tname = element.getName();
if ("name".equals(tname)) {
name = element.getBody();
} else if ("function-class".equals(tname)) {
klass = element.getBody();
} else if ("function-signature".equals(tname)) {
signature = element.getBody();
} else if ("display-name".equals(tname) || // Ignored elements
"small-icon".equals(tname) || "large-icon".equals(tname)
|| "description".equals(tname) || "example".equals(tname)) {
} else {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage(
"jsp.warning.unknown.element.in.function", tname));
}
}
}
return new FunctionInfo(name, klass, signature);
}
示例7: getUriFromTld
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
private String getUriFromTld(String resourcePath, InputStream in)
throws JasperException
{
// Parse the tag library descriptor at the specified resource path
TreeNode tld = new ParserUtils().parseXMLDocument(resourcePath, in);
TreeNode uri = tld.findChild("uri");
if (uri != null) {
String body = uri.getBody();
if (body != null)
return body;
}
return null;
}
示例8: createFunctionInfo
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
FunctionInfo createFunctionInfo(TreeNode elem) {
String name = null;
String klass = null;
String signature = null;
Iterator list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
if ("name".equals(tname)) {
name = element.getBody();
} else if ("function-class".equals(tname)) {
klass = element.getBody();
} else if ("function-signature".equals(tname)) {
signature = element.getBody();
} else if ("display-name".equals(tname) || // Ignored elements
"small-icon".equals(tname) || "large-icon".equals(tname)
|| "description".equals(tname) || "example".equals(tname)) {
} else {
log.warn(Localizer.getMessage(
"jsp.warning.unknown.element.in.function", tname));
}
}
return new FunctionInfo(name, klass, signature);
}
示例9: 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;
}
示例10: tldScanStream
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
private void tldScanStream(String resourcePath, String entryName, InputStream stream) throws IOException {
try {
// Parse the tag library descriptor at the specified resource path
String uri = null;
boolean validate = Boolean.parseBoolean(ctxt.getInitParameter(Constants.XML_VALIDATION_TLD_INIT_PARAM));
String blockExternalString = ctxt.getInitParameter(Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
boolean blockExternal;
if (blockExternalString == null) {
blockExternal = true;
} else {
blockExternal = Boolean.parseBoolean(blockExternalString);
}
ParserUtils pu = new ParserUtils(validate, blockExternal);
TreeNode tld = pu.parseXMLDocument(resourcePath, stream);
TreeNode uriNode = tld.findChild("uri");
if (uriNode != null) {
String body = uriNode.getBody();
if (body != null)
uri = body;
}
// Add implicit map entry only if its uri is not already
// present in the map
if (uri != null && mappings.get(uri) == null) {
TldLocation location;
if (entryName == null) {
location = new TldLocation(resourcePath);
} else {
location = new TldLocation(entryName, resourcePath);
}
mappings.put(uri, location);
}
} catch (JasperException e) {
// Hack - makes exception handling simpler
throw new IOException(e);
}
}
示例11: createTagFileInfo
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
private TagFileInfo createTagFileInfo(TreeNode elem, JarResource jarResource) throws JasperException {
String name = null;
String path = null;
Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
TreeNode child = list.next();
String tname = child.getName();
if ("name".equals(tname)) {
name = child.getBody();
} else if ("path".equals(tname)) {
path = child.getBody();
} else if ("example".equals(tname)) {
// Ignore <example> element: Bugzilla 33538
} else if ("tag-extension".equals(tname)) {
// Ignore <tag-extension> element: Bugzilla 33538
} else if ("icon".equals(tname) || "display-name".equals(tname) || "description".equals(tname)) {
// Ignore these elements: Bugzilla 38015
} else {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.tagfile", tname));
}
}
}
if (path.startsWith("/META-INF/tags")) {
// Tag file packaged in JAR
// See https://bz.apache.org/bugzilla/show_bug.cgi?id=46471
// This needs to be removed once all the broken code that depends on
// it has been removed
ctxt.setTagFileJarResource(path, jarResource);
} else if (!path.startsWith("/WEB-INF/tags")) {
err.jspError("jsp.error.tagfile.illegalPath", path);
}
TagInfo tagInfo = TagFileProcessor.parseTagFileDirectives(parserController, name, path, jarResource, this);
return new TagFileInfo(name, path, tagInfo);
}
示例12: createFunctionInfo
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
FunctionInfo createFunctionInfo(TreeNode elem) {
String name = null;
String klass = null;
String signature = null;
Iterator<TreeNode> list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = list.next();
String tname = element.getName();
if ("name".equals(tname)) {
name = element.getBody();
} else if ("function-class".equals(tname)) {
klass = element.getBody();
} else if ("function-signature".equals(tname)) {
signature = element.getBody();
} else if ("display-name".equals(tname) || // Ignored elements
"small-icon".equals(tname) || "large-icon".equals(tname) || "description".equals(tname)
|| "example".equals(tname)) {
} else {
if (log.isWarnEnabled()) {
log.warn(Localizer.getMessage("jsp.warning.unknown.element.in.function", tname));
}
}
}
return new FunctionInfo(name, klass, signature);
}
示例13: createFunctionInfo
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
private FunctionInfo createFunctionInfo(TreeNode elem)
throws JasperException {
String name = null;
String klass = null;
String signature = null;
Iterator list = elem.findChildren();
while (list.hasNext()) {
TreeNode element = (TreeNode) list.next();
String tname = element.getName();
if ("name".equals(tname)) {
name = element.getBody();
} else if ("function-class".equals(tname)) {
klass = element.getBody();
} else if ("function-signature".equals(tname)) {
signature = element.getBody();
} else if ("display-name".equals(tname) || // Ignored elements
"small-icon".equals(tname) ||
"large-icon".equals(tname) ||
"description".equals(tname) ||
"example".equals(tname)) {
} else {
err.jspError("jsp.error.unknown.element.in.function",
tname);
}
}
return new FunctionInfo(name, klass, signature);
}
示例14: tldScanStream
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
private void tldScanStream(String resourcePath, String entryName,
InputStream stream) throws IOException {
try {
// Parse the tag library descriptor at the specified resource path
String uri = null;
TreeNode tld =
new ParserUtils().parseXMLDocument(resourcePath, stream);
TreeNode uriNode = tld.findChild("uri");
if (uriNode != null) {
String body = uriNode.getBody();
if (body != null)
uri = body;
}
// Add implicit map entry only if its uri is not already
// present in the map
if (uri != null && mappings.get(uri) == null) {
TldLocation location;
if (entryName == null) {
location = new TldLocation(resourcePath);
} else {
location = new TldLocation(entryName, resourcePath);
}
mappings.put(uri, location);
}
} catch (JasperException e) {
// Hack - makes exception handling simpler
throw new IOException(e);
}
}
示例15: tldScanWebXml
import org.apache.jasper.xmlparser.TreeNode; //导入依赖的package包/类
private void tldScanWebXml() throws Exception {
WebXml webXml = null;
try {
webXml = new WebXml(ctxt);
if (webXml.getInputSource() == null) {
return;
}
boolean validate = Boolean.parseBoolean(
ctxt.getInitParameter(
Constants.XML_VALIDATION_INIT_PARAM));
String blockExternalString = ctxt.getInitParameter(
Constants.XML_BLOCK_EXTERNAL_INIT_PARAM);
boolean blockExternal;
if (blockExternalString == null) {
blockExternal = true;
} else {
blockExternal = Boolean.parseBoolean(blockExternalString);
}
// Parse the web application deployment descriptor
ParserUtils pu = new ParserUtils(validate, blockExternal);
TreeNode webtld = null;
webtld = pu.parseXMLDocument(webXml.getSystemId(),
webXml.getInputSource());
// Allow taglib to be an element of the root or jsp-config (JSP2.0)
TreeNode jspConfig = webtld.findChild("jsp-config");
if (jspConfig != null) {
webtld = jspConfig;
}
Iterator<TreeNode> taglibs = webtld.findChildren("taglib");
while (taglibs.hasNext()) {
// Parse the next <taglib> element
TreeNode taglib = taglibs.next();
String tagUri = null;
String tagLoc = null;
TreeNode child = taglib.findChild("taglib-uri");
if (child != null)
tagUri = child.getBody();
child = taglib.findChild("taglib-location");
if (child != null)
tagLoc = child.getBody();
// Save this location if appropriate
if (tagLoc == null)
continue;
if (uriType(tagLoc) == NOROOT_REL_URI)
tagLoc = "/WEB-INF/" + tagLoc;
TldLocation location;
if (tagLoc.endsWith(JAR_EXT)) {
location = new TldLocation("META-INF/taglib.tld", ctxt.getResource(tagLoc).toString());
} else {
location = new TldLocation(tagLoc);
}
mappings.put(tagUri, location);
}
} finally {
if (webXml != null) {
webXml.close();
}
}
}