Node (Apache Tomcat 11.0.25 API Documentation)
Description: declaration: package: org.apache.jasper.compiler, class: Node

# Class Node

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

All Implemented Interfaces:
  `TagConstants`

Direct Known Subclasses:
  `Node.AttributeDirective, Node.AttributeGenerator, Node.ChildInfoBase, Node.Comment, Node.DoBodyAction, Node.ELExpression, Node.ForwardAction, Node.GetProperty, Node.IncludeAction, Node.IncludeDirective, Node.InvokeAction, Node.JspElement, Node.JspOutput, Node.JspRoot, Node.JspText, Node.PageDirective, Node.ParamAction, Node.Root, Node.ScriptingElement, Node.SetProperty, Node.TagDirective, Node.TaglibDirective, Node.TemplateText, Node.UninterpretedTag, Node.UseBean, Node.VariableDirective`

public abstract class Node extends Object implements TagConstants
An internal data representation of a JSP page or a JSP document (XML). Also included here is a visitor class for traversing nodes.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Node.AttributeDirective`
  Represents an attribute directive
  `static class`
  `Node.AttributeGenerator`
  Used as a placeholder for the evaluation code of a custom action attribute (used by the tag plugin machinery only).
  `static class`
  `Node.ChildInfo`
  Collected information about child elements.
  `static class`
  `Node.ChildInfoBase`
  Base class for nodes that collect child element information.
  `static class`
  `Node.Comment`
  Represents a Jsp comment Comments are kept for completeness.
  `static class`
  `Node.CustomTag`
  Represents a custom tag
  `static class`
  `Node.Declaration`
  Represents a declaration
  `static class`
  `Node.DoBodyAction`
  Represents a <jsp:doBody> tag file action
  `static class`
  `Node.ELExpression`
  Represents an EL expression.
  `static class`
  `Node.Expression`
  Represents an expression.
  `static class`
  `Node.ForwardAction`
  Represents a forward action
  `static class`
  `Node.GetProperty`
  Represents a getProperty action
  `static class`
  `Node.IncludeAction`
  Represents an include action
  `static class`
  `Node.IncludeDirective`
  Represents an include directive
  `static class`
  `Node.InvokeAction`
  Represents a <jsp:invoke> tag file action
  `static class`
  `Node.JspAttribute`
  Represents attributes that can be request time expressions.
  `static class`
  `Node.JspBody`
  Represents a JspBody node (<jsp:body>)
  `static class`
  `Node.JspElement`
  Represents a <jsp:element>.
  `static class`
  `Node.JspOutput`
  Represents a <jsp:output>.
  `static class`
  `Node.JspRoot`
  Represents the root of a Jsp document (XML syntax)
  `static class`
  `Node.JspText`
  Represents the body of a <jsp:text> element
  `static class`
  `Node.NamedAttribute`
  Represents a Named Attribute (<jsp:attribute>)
  `static class`
  `Node.Nodes`
  An ordered list of Node, used to represent the body of an element, or a jsp page of jsp document.
  `static class`
  `Node.PageDirective`
  Represents a page directive
  `static class`
  `Node.ParamAction`
  Represents a param action
  `static class`
  `Node.Root`
  Represents the root of a Jsp page or Jsp document
  `static class`
  `Node.ScriptingElement`
  Represents an expression, declaration, or scriptlet
  `static class`
  `Node.Scriptlet`
  Represents a scriptlet
  `static class`
  `Node.SetProperty`
  Represents a setProperty action
  `static class`
  `Node.TagDirective`
  Represents a tag directive
  `static class`
  `Node.TaglibDirective`
  Represents a custom taglib directive
  `static class`
  `Node.TemplateText`
  Represents a template text string
  `static class`
  `Node.UninterpretedTag`
  Represents an uninterpreted tag, from a Jsp document
  `static class`
  `Node.UseBean`
  Represents a useBean action
  `static class`
  `Node.VariableDirective`
  Represents a variable directive
  `static class`
  `Node.Visitor`
  A visitor class for visiting the node.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Attributes`
  `attrs`
  The attributes for this node.
  `protected int`
  `beginJavaLine`
  The starting line number in the generated Java code.
  `protected Node.Nodes`
  `body`
  The body of this node.
  `protected int`
  `endJavaLine`
  The ending line number in the generated Java code.
  `protected String`
  `innerClassName`
  The name of the inner class to which the codes for this node and its body are generated.
  `protected String`
  `localName`
  The local name of this node.
  `protected Node.Nodes`
  `namedAttributeNodes`
  Cached named attribute nodes for performance.
  `protected Attributes`
  `nonTaglibXmlnsAttrs`
  The xmlns attributes that do not represent tag libraries (only in XML syntax).
  `protected Node`
  `parent`
  The parent node in the parse tree.
  `protected String`
  `qName`
  The qualified name of this node.
  `protected Mark`
  `startMark`
  The location in the source file where this node begins.
  `protected Attributes`
  `taglibAttrs`
  The xmlns attributes that represent tag libraries (only in XML syntax).
  `protected String`
  `text`
  The text content associated with this node.

  ### Fields inherited from interface TagConstants

  `ATTRIBUTE_ACTION, ATTRIBUTE_DIRECTIVE_ACTION, BODY_ACTION, DECLARATION_ACTION, DIRECTIVE_ACTION, DOBODY_ACTION, ELEMENT_ACTION, EXPRESSION_ACTION, FORWARD_ACTION, GET_PROPERTY_ACTION, INCLUDE_ACTION, INCLUDE_DIRECTIVE_ACTION, INVOKE_ACTION, JSP_ATTRIBUTE_ACTION, JSP_ATTRIBUTE_DIRECTIVE_ACTION, JSP_BODY_ACTION, JSP_DECLARATION_ACTION, JSP_DOBODY_ACTION, JSP_ELEMENT_ACTION, JSP_EXPRESSION_ACTION, JSP_FORWARD_ACTION, JSP_GET_PROPERTY_ACTION, JSP_INCLUDE_ACTION, JSP_INCLUDE_DIRECTIVE_ACTION, JSP_INVOKE_ACTION, JSP_OUTPUT_ACTION, JSP_PAGE_DIRECTIVE_ACTION, JSP_PARAM_ACTION, JSP_ROOT_ACTION, JSP_SCRIPTLET_ACTION, JSP_SET_PROPERTY_ACTION, JSP_TAG_DIRECTIVE_ACTION, JSP_TAGLIB_DIRECTIVE_ACTION, JSP_TEXT_ACTION, JSP_TEXT_ACTION_END, JSP_URI, JSP_USE_BEAN_ACTION, JSP_VARIABLE_DIRECTIVE_ACTION, OUTPUT_ACTION, PAGE_DIRECTIVE_ACTION, PARAM_ACTION, ROOT_ACTION, SCRIPTLET_ACTION, SET_PROPERTY_ACTION, TAG_DIRECTIVE_ACTION, TAGLIB_DIRECTIVE_ACTION, TEXT_ACTION, URN_JSPTAGDIR, URN_JSPTLD, USE_BEAN_ACTION, VARIABLE_DIRECTIVE_ACTION`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Attributes`
  `getAttributes()`
  Gets this Node's attributes.
  `String`
  `getAttributeValue(String name)`
  Returns the value of the attribute with the given name.
  `int`
  `getBeginJavaLine()`
  Returns the starting line number in the generated Java code.
  `Node.Nodes`
  `getBody()`
  Returns the body of this node.
  `int`
  `getEndJavaLine()`
  Returns the ending line number in the generated Java code.
  `String`
  `getInnerClassName()`
  Returns the name of the inner class for this node.
  `String`
  `getLocalName()`
  Returns the local name of this node.
  `Node.NamedAttribute`
  `getNamedAttributeNode(String name)`
  Searches all sub-nodes of this node for jsp:attribute standard actions with the given name.
  `Node.Nodes`
  `getNamedAttributeNodes()`
  Searches all subnodes of this node for jsp:attribute standard actions, and returns that set of nodes as a Node.Nodes object.
  `Attributes`
  `getNonTaglibXmlnsAttributes()`
  Gets this Node's xmlns attributes that do not represent tag libraries (only meaningful for Nodes parsed from XML syntax).
  `Node`
  `getParent()`
  Returns the parent node.
  `String`
  `getQName()`
  Returns the qualified name of this node.
  `Node.Root`
  `getRoot()`
  Returns the root node of the parse tree.
  `Mark`
  `getStart()`
  Returns the start mark (location) of this node.
  `Attributes`
  `getTaglibAttributes()`
  Gets this Node's xmlns attributes that represent tag libraries (only meaningful for Nodes parsed from XML syntax).
  `String`
  `getText()`
  Returns the text content of this node.
  `String`
  `getTextAttribute(String name)`
  Get the attribute that is non request time expression, either from the attribute of the node, or from a jsp:attribute
  `void`
  `setAttributes(Attributes attrs)`
  Sets the attributes for this node.
  `void`
  `setBeginJavaLine(int begin)`
  Sets the starting line number in the generated Java code.
  `void`
  `setBody(Node.Nodes body)`
  Sets the body of this node.
  `void`
  `setEndJavaLine(int end)`
  Sets the ending line number in the generated Java code.
  `void`
  `setInnerClassName(String icn)`
  Sets the name of the inner class for this node.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### attrs

    protected Attributes attrs
    The attributes for this node.

  - ### taglibAttrs

    protected Attributes taglibAttrs
    The xmlns attributes that represent tag libraries (only in XML syntax).

  - ### nonTaglibXmlnsAttrs

    protected Attributes nonTaglibXmlnsAttrs
    The xmlns attributes that do not represent tag libraries (only in XML syntax).

  - ### body

    protected Node.Nodes body
    The body of this node.

  - ### text

    protected String text
    The text content associated with this node.

  - ### startMark

    protected Mark startMark
    The location in the source file where this node begins.

  - ### beginJavaLine

    protected int beginJavaLine
    The starting line number in the generated Java code.

  - ### endJavaLine

    protected int endJavaLine
    The ending line number in the generated Java code.

  - ### parent

    protected Node parent
    The parent node in the parse tree.

  - ### namedAttributeNodes

    protected Node.Nodes namedAttributeNodes
    Cached named attribute nodes for performance.

  - ### qName

    protected String qName
    The qualified name of this node.

  - ### localName

    protected String localName
    The local name of this node.

  - ### innerClassName

    protected String innerClassName
    The name of the inner class to which the codes for this node and its body are generated. For instance, for <jsp:body> in foo.jsp, this is "foo_jspHelper". This is primarily used for communicating such info from Generator to Smap generator.

- ## Method Details

  - ### getQName

    public String getQName()
    Returns the qualified name of this node.
    Returns:
      The qualified name

  - ### getLocalName

    public String getLocalName()
    Returns the local name of this node.
    Returns:
      The local name

  - ### getAttributes

    public Attributes getAttributes()
    Gets this Node's attributes.

    In the case of a Node parsed from standard syntax, this method returns all the Node's attributes.

    In the case of a Node parsed from XML syntax, this method returns only those attributes whose name does not start with xmlns.

    Returns:
      The attributes

  - ### getTaglibAttributes

    public Attributes getTaglibAttributes()
    Gets this Node's xmlns attributes that represent tag libraries (only meaningful for Nodes parsed from XML syntax).
    Returns:
      The taglib attributes

  - ### getNonTaglibXmlnsAttributes

    public Attributes getNonTaglibXmlnsAttributes()
    Gets this Node's xmlns attributes that do not represent tag libraries (only meaningful for Nodes parsed from XML syntax).
    Returns:
      The non-taglib xmlns attributes

  - ### setAttributes

    public void setAttributes(Attributes attrs)
    Sets the attributes for this node.
    Parameters:
      `attrs` - The attributes to set

  - ### getAttributeValue

    public String getAttributeValue(String name)
    Returns the value of the attribute with the given name.
    Parameters:
      `name` - The name of the attribute
    Returns:
      The attribute value, or `null` if not found

  - ### getTextAttribute

    public String getTextAttribute(String name)
    Get the attribute that is non request time expression, either from the attribute of the node, or from a jsp:attribute
    Parameters:
      `name` - The name of the attribute
    Returns:
      The attribute value

  - ### getNamedAttributeNode

    public Node.NamedAttribute getNamedAttributeNode(String name)
    Searches all sub-nodes of this node for jsp:attribute standard actions with the given name.

    This should always be called and only be called for nodes that accept dynamic runtime attribute expressions.

    Parameters:
      `name` - The name of the attribute
    Returns:
      the NamedAttribute node of the matching named attribute, nor null if no such node is found.

  - ### getNamedAttributeNodes

    public Node.Nodes getNamedAttributeNodes()
    Searches all subnodes of this node for jsp:attribute standard actions, and returns that set of nodes as a Node.Nodes object.
    Returns:
      Possibly empty Node.Nodes object containing any jsp:attribute subnodes of this Node

  - ### getBody

    public Node.Nodes getBody()
    Returns the body of this node.
    Returns:
      The body nodes

  - ### setBody

    public void setBody(Node.Nodes body)
    Sets the body of this node.
    Parameters:
      `body` - The body nodes

  - ### getText

    public String getText()
    Returns the text content of this node.
    Returns:
      The text content

  - ### getStart

    public Mark getStart()
    Returns the start mark (location) of this node.
    Returns:
      The start mark

  - ### getParent

    public Node getParent()
    Returns the parent node.
    Returns:
      The parent node

  - ### getBeginJavaLine

    public int getBeginJavaLine()
    Returns the starting line number in the generated Java code.
    Returns:
      The starting Java line number

  - ### setBeginJavaLine

    public void setBeginJavaLine(int begin)
    Sets the starting line number in the generated Java code.
    Parameters:
      `begin` - The starting Java line number

  - ### getEndJavaLine

    public int getEndJavaLine()
    Returns the ending line number in the generated Java code.
    Returns:
      The ending Java line number

  - ### setEndJavaLine

    public void setEndJavaLine(int end)
    Sets the ending line number in the generated Java code.
    Parameters:
      `end` - The ending Java line number

  - ### getRoot

    public Node.Root getRoot()
    Returns the root node of the parse tree.
    Returns:
      The root node

  - ### getInnerClassName

    public String getInnerClassName()
    Returns the name of the inner class for this node.
    Returns:
      The inner class name

  - ### setInnerClassName

    public void setInnerClassName(String icn)
    Sets the name of the inner class for this node.
    Parameters:
      `icn` - The inner class name