Package org.apache.jasper.xmlparser

Examples of org.apache.jasper.xmlparser.TreeNode


            } else {
                blockExternal = Boolean.parseBoolean(blockExternalString);
            }

            ParserUtils pu = new ParserUtils(validate, blockExternal);
            TreeNode webApp = pu.parseXMLDocument(WEB_XML, ip);

            if (webApp == null
                    || getVersion(webApp) < 2.4) {
                defaultIsELIgnored = "true";
                defaultDeferedSyntaxAllowedAsLiteral = "true";
                return;
            }
            if (getVersion(webApp) < 2.5) {
                defaultDeferedSyntaxAllowedAsLiteral = "true";
            }
            TreeNode jspConfig = webApp.findChild("jsp-config");
            if (jspConfig == null) {
                return;
            }

            jspProperties = new Vector();
            Iterator jspPropertyList = jspConfig.findChildren("jsp-property-group");
            while (jspPropertyList.hasNext()) {

                TreeNode element = (TreeNode) jspPropertyList.next();
                Iterator list = element.findChildren();

                Vector urlPatterns = new Vector();
                String pageEncoding = null;
                String scriptingInvalid = null;
                String elIgnored = null;
                String isXml = null;
                Vector includePrelude = new Vector();
                Vector includeCoda = new Vector();
                String deferredSyntaxAllowedAsLiteral = null;
                String trimDirectiveWhitespaces = null;

                while (list.hasNext()) {

                    element = (TreeNode) list.next();
                    String tname = element.getName();

                    if ("url-pattern".equals(tname))
                        urlPatterns.addElement( element.getBody() );
                    else if ("page-encoding".equals(tname))
                        pageEncoding = element.getBody();
                    else if ("is-xml".equals(tname))
                        isXml = element.getBody();
                    else if ("el-ignored".equals(tname))
                        elIgnored = element.getBody();
                    else if ("scripting-invalid".equals(tname))
                        scriptingInvalid = element.getBody();
                    else if ("include-prelude".equals(tname))
                        includePrelude.addElement(element.getBody());
                    else if ("include-coda".equals(tname))
                        includeCoda.addElement(element.getBody());
                    else if ("deferred-syntax-allowed-as-literal".equals(tname))
                        deferredSyntaxAllowedAsLiteral = element.getBody();
                    else if ("trim-directive-whitespaces".equals(tname))
                        trimDirectiveWhitespaces = element.getBody();
                }

                if (urlPatterns.size() == 0) {
                    continue;
                }
View Full Code Here


        blockExternal = Boolean.parseBoolean(blockExternalString);
    }

    ParserUtils pu = new ParserUtils(false, blockExternal);

  TreeNode root = pu.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();
  Iterator pluginList = root.findChildren("tag-plugin");
  while (pluginList.hasNext()) {
      TreeNode pluginNode = (TreeNode) 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

                            } else {
                                blockExternal = Boolean.parseBoolean(blockExternalString);
                            }

                            ParserUtils pu = new ParserUtils(validate, blockExternal);
                            TreeNode tld = pu.parseXMLDocument(uri, in);

                            if (tld.findAttribute("version") != null) {
                                this.jspversion = tld.findAttribute("version");
                            }

                            // Process each child element of our <taglib> element
                            Iterator list = tld.findChildren();

                            while (list.hasNext()) {
                                TreeNode element = (TreeNode) list.next();
                                String tname = element.getName();

                                if ("tlibversion".equals(tname) // JSP 1.1
                                        || "tlib-version".equals(tname)) { // JSP 1.2
                                    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)) {
                                    // Ignore
                                } else {
                                    // All other elements are invalid
                                    err.jspError("jsp.error.invalid.implicit", path);
View Full Code Here

        Vector<TagFileInfo> tagFileVector = new Vector<TagFileInfo>();
        Hashtable<String, FunctionInfo> functionTable = new Hashtable<String, FunctionInfo>();

        // Create an iterator over the child elements of our <taglib> element
        ParserUtils pu = new ParserUtils();
        TreeNode tld = pu.parseXMLDocument(uri, in);

        // Check to see if the <taglib> root element contains a 'version'
        // attribute, which was added in JSP 2.0 to replace the <jsp-version>
        // subelement
        this.jspversion = tld.findAttribute("version");

        // Process each child element of our <taglib> element
        Iterator<TreeNode> list = tld.findChildren();

        while (list.hasNext()) {
            TreeNode element = list.next();
            String tname = element.getName();

            if ("tlibversion".equals(tname) // JSP 1.1
                    || "tlib-version".equals(tname)) { // JSP 1.2
                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))
                this.shortname = element.getBody();
            else if ("uri".equals(tname))
                this.urn = element.getBody();
            else if ("info".equals(tname) || "description".equals(tname))
                this.info = element.getBody();
            else if ("validator".equals(tname))
                this.tagLibraryValidator = createValidator(element);
            else if ("tag".equals(tname))
                tagVector.addElement(createTagInfo(element, jspversion));
            else if ("tag-file".equals(tname)) {
View Full Code Here

        Vector<TagAttributeInfo> attributeVector = new Vector<TagAttributeInfo>();
        Vector<TagVariableInfo> variableVector = new Vector<TagVariableInfo>();
        Iterator<TreeNode> list = elem.findChildren();
        while (list.hasNext()) {
            TreeNode element = list.next();
            String tname = element.getName();

            if ("name".equals(tname)) {
                tagName = element.getBody();
            } else if ("tagclass".equals(tname) || "tag-class".equals(tname)) {
                tagClassName = element.getBody();
            } else if ("teiclass".equals(tname) || "tei-class".equals(tname)) {
                teiClassName = 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 ("icon".equals(tname)) {
                TreeNode icon = element.findChild("small-icon");
                if (icon != null) {
                    smallIcon = icon.getBody();
                }
                icon = element.findChild("large-icon");
                if (icon != null) {
                    largeIcon = icon.getBody();
                }
            } else if ("info".equals(tname) || "description".equals(tname)) {
                info = element.getBody();
            } else if ("variable".equals(tname)) {
                variableVector.addElement(createVariable(element));
View Full Code Here

        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)
View Full Code Here

        String methodSignature = null;
        boolean required = false, rtexprvalue = false, isFragment = false, deferredValue = false, deferredMethod = false;

        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 ("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();
                if ("1.2".equals(jspVersion)
                        && (type.equals("Boolean") || type.equals("Byte")
                                || type.equals("Character")
                                || type.equals("Double")
                                || type.equals("Float")
                                || type.equals("Integer")
                                || type.equals("Long") || type.equals("Object")
                                || type.equals("Short") || type
                                .equals("String"))) {
                    type = "java.lang." + type;
                }
            } else if ("fragment".equals(tname)) {
                String s = element.getBody();
                if (s != null) {
                    isFragment = JspUtil.booleanValue(s);
                }
            } else if ("deferred-value".equals(tname)) {
                deferredValue = true;
                type = "javax.el.ValueExpression";
                TreeNode child = element.findChild("type");
                if (child != null) {
                    expectedType = child.getBody();
                    if (expectedType != null) {
                        expectedType = expectedType.trim();
                    }
                } else {
                    expectedType = "java.lang.Object";
                }
            } else if ("deferred-method".equals(tname)) {
                deferredMethod = true;
                type = "javax.el.MethodExpression";
                TreeNode child = element.findChild("method-signature");
                if (child != null) {
                    methodSignature = child.getBody();
                    if (methodSignature != null) {
                        methodSignature = methodSignature.trim();
                    }
                } else {
                    methodSignature = "java.lang.Object method()";
View Full Code Here

        boolean declare = true;
        int scope = VariableInfo.NESTED;

        Iterator<TreeNode> list = elem.findChildren();
        while (list.hasNext()) {
            TreeNode element = 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<String,Object> initParams = new Hashtable<String,Object>();

        Iterator<TreeNode> list = elem.findChildren();
        while (list.hasNext()) {
            TreeNode element = 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<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(
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.