## org.apache.jasper.compiler
Class JspUtil

    java.lang.Object
      org.apache.jasper.compiler.JspUtil

public class JspUtil
extends java.lang.Object

This class has all the utility method(s). Ideally should move all the bean containers here.

Author:
  Mandar Raje., Rajiv Mordani., Danno Ferrin, Pierre Delisle

Nested Class Summary
`static class` `JspUtil.ValidAttribute`

Constructor Summary
`JspUtil()`

Method Summary
`static java.util.Hashtable` `attrsToHashtable(org.xml.sax.Attributes attrs)`
`static boolean` `booleanValue(java.lang.String s)` Convert a String value to 'boolean'.
`static void` `checkAttributes(java.lang.String typeOfTag, org.xml.sax.Attributes attrs, JspUtil.ValidAttribute[] validAttributes, Mark start, ErrorDispatcher err)`
`static java.lang.String` `escapeQueryString(java.lang.String unescString)`
`static char[]` `escapeQuotes(char[] chars)`
`static java.lang.String` `escapeXml(java.lang.String s)` Escape the 5 entities defined by XML.
`static java.lang.String` `getCanonicalName(java.lang.Class c)` Compute the canonical name from a Class instance.
`static java.lang.String` `getElementChildTextData(org.w3c.dom.Element e)` Get the data for the first child associated with the Element provided as argument.
`static java.lang.String` `getExpr(java.lang.String expression, boolean isXml)`
`static java.lang.String` `getExprInXml(java.lang.String expression)` Takes a potential expression and converts it into XML form
`static boolean` `isExpression(java.lang.String token, boolean isXml)` Checks if the token is a runtime expression.
`static org.w3c.dom.Document` `parseXMLDoc(java.lang.String uri, java.io.InputStream in)` Deprecated. Use ParserUtils.parseXMLDocument() instead
`static org.w3c.dom.Document` `parseXMLDocJaxp(java.lang.String uri, java.io.InputStream in)` Deprecated. Use ParserUtils.parseXMLDocument() instead
`static char[]` `removeQuotes(char[] chars)`
`static java.lang.String` `replace(java.lang.String name, char replace, java.lang.String with)` Replaces any occurrence of `replace` with `with` in the given string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JspUtil

    public JspUtil()

Method Detail

### removeQuotes

    public static char[] removeQuotes(char[] chars)

### escapeQuotes

    public static char[] escapeQuotes(char[] chars)

### isExpression

    public static boolean isExpression(java.lang.String token,
                                       boolean isXml)

  Checks if the token is a runtime expression. In standard JSP syntax, a runtime expression starts with '<%' and ends with '%>'. When the JSP document is in XML syntax, a runtime expression starts with '%=' and ends with '%'.

  Parameters:
    `token` - The token to be checked return whether the token is a runtime expression or not.

### getExpr

    public static java.lang.String getExpr(java.lang.String expression,
                                           boolean isXml)

  Returns:
    the "expression" part of a runtime expression, taking the delimiters out.

### getExprInXml

    public static java.lang.String getExprInXml(java.lang.String expression)

  Takes a potential expression and converts it into XML form

### parseXMLDoc

    public static org.w3c.dom.Document parseXMLDoc(java.lang.String uri,
                                                   java.io.InputStream in)
                                            throws JasperException

  Deprecated. Use ParserUtils.parseXMLDocument() instead

  Parses the XML document contained in the InputStream.

  Throws:
    `JasperException`

### parseXMLDocJaxp

    public static org.w3c.dom.Document parseXMLDocJaxp(java.lang.String uri,
                                                       java.io.InputStream in)
                                                throws JasperException

  Deprecated. Use ParserUtils.parseXMLDocument() instead

  Parses the XML document contained in the InputStream. This XML document is either web.xml or a tld. [The TLD has to be cached internally (see MyEntityResolver)]

  Throws:
    `JasperException`

### checkAttributes

    public static void checkAttributes(java.lang.String typeOfTag,
                                       org.xml.sax.Attributes attrs,
                                       JspUtil.ValidAttribute[] validAttributes,
                                       Mark start,
                                       ErrorDispatcher err)
                                throws JasperException

  Throws:
    `JasperException`

### escapeQueryString

    public static java.lang.String escapeQueryString(java.lang.String unescString)

### escapeXml

    public static java.lang.String escapeXml(java.lang.String s)

  Escape the 5 entities defined by XML.

### replace

    public static java.lang.String replace(java.lang.String name,
                                           char replace,
                                           java.lang.String with)

  Replaces any occurrence of `replace` with `with` in the given string.

### attrsToHashtable

    public static java.util.Hashtable attrsToHashtable(org.xml.sax.Attributes attrs)

### getElementChildTextData

    public static java.lang.String getElementChildTextData(org.w3c.dom.Element e)

  Get the data for the first child associated with the Element provided as argument. It is assumed that this first child is of type Text.

  Parameters:
    `e` - the DOM Element to read from
  Returns:
    the data associated with the first child of the DOM element.

### booleanValue

    public static boolean booleanValue(java.lang.String s)

  Convert a String value to 'boolean'. Besides the standard conversions done by Boolean.valueOf(s).booleanValue(), the value "yes" (ignore case) is also converted to 'true'. If 's' is null, then 'false' is returned.

  Parameters:
    `s` - the string to be converted
  Returns:
    the boolean value associated with the string s

### getCanonicalName

    public static java.lang.String getCanonicalName(java.lang.Class c)

  Compute the canonical name from a Class instance. Note that a simple replacment of '$' with '.' of a binary name would not work, as '$' is a legal Java Identifier character.

  Parameters:
    `c` - A instance of java.lang.Class
  Returns:
    The canonical name of c.

Copyright © 2000 Apache Software Foundation. All Rights Reserved.