本文整理汇总了Java中org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument方法的典型用法代码示例。如果您正苦于以下问题:Java ParserUtils.parseXMLDocument方法的具体用法?Java ParserUtils.parseXMLDocument怎么用?Java ParserUtils.parseXMLDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jasper.xmlparser.ParserUtils
的用法示例。
在下文中一共展示了ParserUtils.parseXMLDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tldScanStream
import org.apache.jasper.xmlparser.ParserUtils; //导入方法依赖的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);
}
}
示例2: tldScanWebXml
import org.apache.jasper.xmlparser.ParserUtils; //导入方法依赖的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();
}
}
}
示例3: tldScanStream
import org.apache.jasper.xmlparser.ParserUtils; //导入方法依赖的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);
}
}
示例4: tldScanWebXml
import org.apache.jasper.xmlparser.ParserUtils; //导入方法依赖的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();
}
}
}