net.fckeditor.tool
Class XHtmlTagTool

java.lang.Object
  extended by net.fckeditor.tool.XHtmlTagTool

public class XHtmlTagTool
extends Object

Java representation of an XHTML tag.

Usage:

 XHtmlTagTool tag = XHtmlTagTool("a", "link");
 tag.addAttribute("href", "http://google.com");
 tag.toString();: <a href="http://google.com">link</a>
 

Note:

Version:
$Id: XHtmlTagTool.java 4785 2009-12-21 20:10:28Z mosipov $

Field Summary
static String SPACE
          Indicator to uses non self-closing tag.
 
Constructor Summary
XHtmlTagTool(String name)
          Class constructor with tag name.
XHtmlTagTool(String name, String value)
          Class constructor with name and value.
 
Method Summary
 void addAttribute(String name, String value)
          Adds an attribute to this tag.
 void setValue(String value)
          Sets the tag value.
 String toString()
          Creates the HTML representation of this tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SPACE

public static final String SPACE
Indicator to uses non self-closing tag.

See Also:
Constant Field Values
Constructor Detail

XHtmlTagTool

public XHtmlTagTool(String name)
Class constructor with tag name.

Parameters:
name - the tag name of the new XHtmlTagTool
Throws:
IllegalArgumentException - if name is empty

XHtmlTagTool

public XHtmlTagTool(String name,
                    String value)
Class constructor with name and value.

Parameters:
name - the tag name of the new XHtmlTagTool
value - the tag value of the new XHtmlTagTool which is the tag body
Throws:
IllegalArgumentException - if name is empty
Method Detail

setValue

public void setValue(String value)
Sets the tag value.

Parameters:
value - the tag value which is the tag body

addAttribute

public void addAttribute(String name,
                         String value)
Adds an attribute to this tag.

Parameters:
name - attribute name
value - attribute value
Throws:
IllegalArgumentException - if name is empty

toString

public String toString()
Creates the HTML representation of this tag. It follows the XHTML standard.

Overrides:
toString in class Object
Returns:
HTML representation of this tag


Copyright © 2004-2010 Frederico Caldeira Knabben. All Rights Reserved.