SimpleServlets v5.5.0

com.simpleservlets.htmlobjects
Class HTMLEntity

java.lang.Object
  extended by com.simpleservlets.htmlobjects.GenericHTMLElement
      extended by com.simpleservlets.htmlobjects.HTMLEntity
All Implemented Interfaces:
DoNotMinimizeEmpty, HTMLElement, NoAttributesAllowed, NoChildrenAllowed, NoTag

public class HTMLEntity
extends GenericHTMLElement
implements HTMLElement, NoTag, NoChildrenAllowed

Represents an HTML entity as an HTMLElement. Does not have a start or end tag (NoTag) and does not support the addition of any children (NoChildrenAllowed).

Author:
Paul Hyde

Field Summary
 
Fields inherited from interface com.simpleservlets.htmlobjects.HTMLElement
ZERO_LEN_ARRAY
 
Constructor Summary
HTMLEntity(String text)
          Does: this(text, null); (no parent currently).
HTMLEntity(String text, HTMLElement parent)
          Creates an entity with the specified text.
 
Method Summary
static HTMLEntity createAmp()
          Creates the & entity for "&" (ampersand).
static HTMLEntity createApos()
          Creates the ' entity for "'" (apostrophe or single quote).
static HTMLEntity createCopy()
          Creates the © entity for "©" (copyright).
static HTMLEntity createGt()
          Creates the > entity for ">" (greater than).
static HTMLEntity createLt()
          Creates the &lt; entity for "<" (less than).
static HTMLEntity createNbsp()
          Creates the &nbsp; entity for " " (non-breaking space).
static HTMLEntity createQuot()
          Creates the &quot; entity for """ (double quote).
static HTMLEntity createReg()
          Creates the &reg; entity for "®" (registered trademark).
static HTMLEntity createTrade()
          Creates the &trade; entity for "™" (trademark).
 String getEntity()
           
 
Methods inherited from class com.simpleservlets.htmlobjects.GenericHTMLElement
add, add, addSibling, addSibling, getAttributes, getChildren, getName, getParent, hasAttributes, hasChildren, isSafeToWrapWithWhitespace, removeAllAttributes, removeAllChildren, removeAttribute, removeChild, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeGroup, setParent, setSafeToWrapWithWhitespace, setStyle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.simpleservlets.htmlobjects.HTMLElement
add, add, addSibling, addSibling, getAttributes, getChildren, getName, getParent, hasAttributes, hasChildren, isSafeToWrapWithWhitespace, removeAllAttributes, removeAllChildren, removeAttribute, removeChild, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributeGroup, setParent, setStyle
 

Constructor Detail

HTMLEntity

public HTMLEntity(String text,
                  HTMLElement parent)
           throws HTMLException
Creates an entity with the specified text. When processed, this text will be prefixed with & and suffixed with ; (for example, the text "nbsp" passed in would produce &nbsp; in the HTML output).

Parameters:
text - the entity body (without the & prefix and ; suffix)
parent - the parent of this element. If null is passed in, then this entity does not currently have a parent.
Throws:
HTMLException - if the specified text is null or trims to a zero-length string.

HTMLEntity

public HTMLEntity(String text)
Does: this(text, null); (no parent currently).

Method Detail

getEntity

public String getEntity()

createLt

public static HTMLEntity createLt()
Creates the &lt; entity for "<" (less than).


createGt

public static HTMLEntity createGt()
Creates the &gt; entity for ">" (greater than).


createAmp

public static HTMLEntity createAmp()
Creates the &amp; entity for "&" (ampersand).


createQuot

public static HTMLEntity createQuot()
Creates the &quot; entity for """ (double quote).


createApos

public static HTMLEntity createApos()
Creates the &apos; entity for "'" (apostrophe or single quote).


createNbsp

public static HTMLEntity createNbsp()
Creates the &nbsp; entity for " " (non-breaking space).


createCopy

public static HTMLEntity createCopy()
Creates the &copy; entity for "©" (copyright).


createReg

public static HTMLEntity createReg()
Creates the &reg; entity for "®" (registered trademark).


createTrade

public static HTMLEntity createTrade()
Creates the &trade; entity for "™" (trademark).


SimpleServlets v5.5.0

Copyright © 2001-2007 Programix Incorporated. All rights reserved. SimpleServlets is free and is OSI Certified Open Source Software under the BSD license.