Package org.apache.jasper.xmlparser

Examples of org.apache.jasper.xmlparser.TreeNode


       
        Vector attributeVector = new Vector();
        Vector variableVector = new Vector();
        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 ("tagclass".equals(tname) ||
                     "tag-class".equals(tname))
                tagclass = element.getBody();
            else if ("teiclass".equals(tname) ||
                     "tei-class".equals(tname))
                teiclass = element.getBody();
            else if ("bodycontent".equals(tname) ||
                     "body-content".equals(tname))
                bodycontent = element.getBody();
            else if ("display-name".equals(tname))
                displayName = element.getBody();
            else if ("small-icon".equals(tname))
                smallIcon = element.getBody();
            else if ("large-icon".equals(tname))
                largeIcon = element.getBody();
            else if ("info".equals(tname) ||
                     "description".equals(tname))
                info = element.getBody();
            else if ("variable".equals(tname)) {
                variableVector.addElement(createVariable(element));
            } else if ("attribute".equals(tname))
                attributeVector.addElement(createAttribute(element));
            else if ("example".equals(tname) ||   // Ignored elements
View Full Code Here


        boolean required = false, rtexprvalue = false, reqTime = false;
        String type = 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 ("required".equals(tname)) {
                String s = element.getBody();
                if (s != null)
                    required = JspUtil.booleanValue(s);
            } else if ("rtexprvalue".equals(tname)) {
                String s = element.getBody();
                if (s != null)
                    rtexprvalue = JspUtil.booleanValue(s);
            } else if ("type".equals(tname))
                type = element.getBody();
            else if ("description".equals(tname) ||    // Ignored elements
             false )
          ;
            else {
                Constants.message("jsp.warning.unknown.element.in.attribute",
View Full Code Here

        boolean declare = true;
        int scope = VariableInfo.NESTED;
       
        Iterator list = elem.findChildren();
        while (list.hasNext()) {
            TreeNode element = (TreeNode) list.next();
            String tname = element.getName();
            if ("name-given".equals(tname))
                nameGiven = element.getBody();
            else if ("name-from-attribute".equals(tname))
                nameFromAttribute = element.getBody();
            else if ("variable-class".equals(tname))
                className = element.getBody();
            else if ("declare".equals(tname)) {
                String s = element.getBody();
                if (s != null)
                    declare = JspUtil.booleanValue(s);
            } else if ("scope".equals(tname)) {
                String s = element.getBody();
                if (s != null) {
                    if ("NESTED".equals(s)) {
                        scope = VariableInfo.NESTED;
                    } else if ("AT_BEGIN".equals(s)) {
                        scope = VariableInfo.AT_BEGIN;
View Full Code Here

        String validatorClass = null;
        Map initParams = new Hashtable();

        Iterator list = elem.findChildren();
        while (list.hasNext()) {
            TreeNode element = (TreeNode) list.next();
            String tname = element.getName();
            if ("validator-class".equals(tname))
                validatorClass = element.getBody();
            else if ("init-param".equals(tname)) {
                String[] initParam = createInitParam(element);
                initParams.put(initParam[0], initParam[1]);
            } else if ("description".equals(tname) ||    // Ignored elements
             false ) {
View Full Code Here

    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 {
                Constants.message("jsp.warning.unknown.element.in.initParam", //@@@ properties
                                  new Object[] {tname},
View Full Code Here

            if (webXml.getInputSource() == null) {
                return;
            }
           
            // Parse the web application deployment descriptor
            TreeNode webtld = null;
            webtld = new ParserUtils().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)
View Full Code Here

        String path = (location.getJarResource() == null) ?  location.getName() : location.getJarResource().getUrl();
        try {
            // Parse the tag library descriptor at the specified resource path
            String uri = null;

            TreeNode tld =
                new ParserUtils().parseXMLDocument(path, 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
View Full Code Here

        InputStream is = ctxt.getResourceAsStream(TAG_PLUGINS_XML);
        if (is == null)
            return;

        TreeNode root = (new ParserUtils()).parseXMLDocument(TAG_PLUGINS_XML,
                                                             is);
        if (root == null) {
            return;
        }

        if (!TAG_PLUGINS_ROOT_ELEM.equals(root.getName())) {
            err.jspError("jsp.error.plugin.wrongRootElement", TAG_PLUGINS_XML,
                         TAG_PLUGINS_ROOT_ELEM);
        }

        tagPlugins = new HashMap<String, TagPlugin>();
        Iterator<TreeNode> pluginList = root.findChildren("tag-plugin");
        while (pluginList.hasNext()) {
            TreeNode pluginNode = pluginList.next();
            TreeNode tagClassNode = pluginNode.findChild("tag-class");
            if (tagClassNode == null) {
                // Error
                return;
            }
            String tagClass = tagClassNode.getBody().trim();
            TreeNode pluginClassNode = pluginNode.findChild("plugin-class");
            if (pluginClassNode == null) {
                // Error
                return;
            }

            String pluginClassStr = pluginClassNode.getBody();
            TagPlugin tagPlugin = null;
            try {
                Class<?> pluginClass = Class.forName(pluginClassStr);
                tagPlugin = (TagPlugin) pluginClass.newInstance();
            } catch (Exception e) {
View Full Code Here

                              Logger.WARNING);
            return;
        }

        // Parse the web application deployment descriptor
        TreeNode webtld = new ParserUtils().parseXMLDocument(WEB_XML, is);

        Iterator taglibs = webtld.findChildren("taglib");
        while (taglibs.hasNext()) {

            // Parse the next <taglib> element
            TreeNode taglib = (TreeNode) 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)
View Full Code Here

     */
    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;
View Full Code Here

TOP

Related Classes of org.apache.jasper.xmlparser.TreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.