|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wiki.util.XhtmlUtil
public final class XhtmlUtil
A utility class to generate XHTML objects and ultimately, serialised markup. This class is incomplete but serves as a basic utility for JSPWiki, to be expanded upon as needed.
This uses JDOM2 as its backing implementation.
To generate a single element, an Element with PCDATA content, and then embed the latter in the former:
Element div = XhtmlUtil.element(XHTML.div); Element p = XhtmlUtil.element(XHTML.p,"Some content"); div.addContent(p);
There is also a convenient link and link target constructor methods:
Element link = XhtmlUtil.link("hrefValue","linkText"); Element target = XhtmlUtil.target("targetIdValue","linkText");
Method Summary | |
---|---|
static org.jdom2.Element |
element(XHTML element)
Return an Element with an element type name matching the parameter. |
static org.jdom2.Element |
element(XHTML element,
String content)
Return an Element with an element type name matching the parameter, and optional PCDATA (parsed character data, a String) content. |
static org.jdom2.Element |
img(String src,
String alt)
Return an XHTML img element with an required 'src' attribute and optional 'alt' alternative text value. |
static org.jdom2.Element |
input(String type,
String name,
String value)
Return an XHTML form input element with optional 'type', 'name' and 'value' attributes. |
static org.jdom2.Element |
link(String href,
String content)
Return an XHTML link with a required 'href' attribute value and optional link (PCDATA) content. |
static String |
serialize(org.jdom2.Element element)
Serializes the Element to a String using a compact serialization format. |
static String |
serialize(org.jdom2.Element element,
boolean pretty)
Serializes the Element to a String. |
static String |
serialize(org.jdom2.Element element,
org.jdom2.output.Format format)
Serializes the Element to a String. |
static void |
setClass(org.jdom2.Element element,
String classValue)
|
static org.jdom2.Element |
target(String id,
String content)
Return an XHTML link target with a required 'id' attribute value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String serialize(org.jdom2.Element element)
element
- the element to serialize.
public static String serialize(org.jdom2.Element element, boolean pretty)
element
- the element to serialize.pretty
- if true, use a pretty whitespace format.
public static String serialize(org.jdom2.Element element, org.jdom2.output.Format format)
element
- the element to serialize.format
- custom format used to serialize the Element.
public static org.jdom2.Element element(XHTML element)
element
- the XHTML element type.
public static org.jdom2.Element element(XHTML element, String content)
element
- the XHTML element type.content
- the optional PCDATA content.
public static org.jdom2.Element link(String href, String content)
href
- the required 'href' value.content
- the optional link (PCDATA) content.
public static org.jdom2.Element target(String id, String content)
id
- the required 'id' link target value.
public static org.jdom2.Element img(String src, String alt)
src
- the required 'src' value.alt
- the optional 'alt' alternative text value.
public static org.jdom2.Element input(String type, String name, String value)
type
- the optional 'type' value.name
- the optional 'name' value.value
- the optional 'value' value.
public static void setClass(org.jdom2.Element element, String classValue)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |