当前位置: 首页>>代码示例>>Java>>正文


Java ParserUtils.parseXMLDocument方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:40,代码来源:TldLocationsCache.java

示例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();
            }
        }
    }
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:67,代码来源:TldLocationsCache.java

示例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);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:44,代码来源:TldLocationsCache.java

示例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();
			}
		}
	}
 
开发者ID:how2j,项目名称:lazycat,代码行数:63,代码来源:TldLocationsCache.java


注:本文中的org.apache.jasper.xmlparser.ParserUtils.parseXMLDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。