|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.xml.sax.helpers.DefaultHandler
com.aliasi.xml.SimpleElementHandler
com.aliasi.xml.SAXWriter
com.aliasi.xml.XHtmlWriter
public class XHtmlWriter
An XHtmlWriter provides constants and convenience
methods for generating strict XHTML 1.0 output. This class includes
the Strict DTD specification:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
The XML version and decoding declaration will be included as in
the parent class SAXWriter, as in:
<?xml version="1.0" encoding="UTF-8"?>
The parent class SAXWriter is set to
use XHTML mode (see SAXWriter.SAXWriter(OutputStream,String,boolean))
output.
It is up to the application to supply an appropriate document
structure and to validate any output. For instance, the top-level
element must be html, and it must specify the
appropriate namespace and language, as in:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
A constant is provided for each legal XHTML element tag and each
XHTML attribute. There are six convenience methods supplied to
start each element. The first five methods allow from zero to four
pairs of attributes and values to be supplied as strings. The
sixth method accepts an arbitrary SAX Attributes object to
supply the attributes. Elements must be closed using the
underlying SAXWriter's end methods, such as SimpleElementHandler.endSimpleElement(String).
Like for SAXWriter, the underlying output stream must be closed
by the calling application after the SAXWriter.endDocument() method
is called.
Warning: No well-formedness checks are performed on the output. In particular, elements may not be balanced leading to invalid XML, or elements may not provide attributes matching the XHTML 1.0 specification. We suggest validating HTML using the W3C validator.
| Field Summary | |
|---|---|
static String |
A
Constant for element a. |
static String |
ABBR
Constant for element abbr. |
static String |
ABBR_ATT
A constant for the abbr attribute. |
static String |
ACCEPT
A constant for the accept attribute. |
static String |
ACCEPT_CHARSET
A constant for the accept-charset attribute. |
static String |
ACCESSKEY
A constant for the accesskey attribute. |
static String |
ACRONYM
Constant for element acronym. |
static String |
ACTION
A constant for the action attribute. |
static String |
ADDRESS
Constant for element address. |
static String |
ALIGN
A constant for the align attribute. |
static String |
ALT
A constant for the alt attribute. |
static String |
APPLET
Constant for element applet. |
static String |
ARCHIVE
A constant for the archive attribute. |
static String |
AREA
Constant for element area. |
static String |
AXIS
A constant for the axis attribute. |
static String |
B
Constant for element b. |
static String |
BASE
Constant for element base. |
static String |
BASEFONT
Constant for element basefont. |
static String |
BDO
Constant for element bdo. |
static String |
BIG
Constant for element big. |
static String |
BLOCKQUOTE
Constant for element blockquote. |
static String |
BODY
Constant for element body. |
static String |
BORDER
A constant for the border attribute. |
static String |
BR
Constant for element br. |
static String |
BUTTON
Constant for element button. |
static String |
CAPTION
Constant for element caption. |
static String |
CELLPADDING
A constant for the cellpadding attribute. |
static String |
CELLSPACING
A constant for the cellspacing attribute. |
static String |
CENTER
Constant for element center. |
static String |
CHAR
A constant for the char attribute. |
static String |
CHAROFF
A constant for the charoff attribute. |
static String |
CHARSET
A constant for the charset attribute. |
static String |
CHECKED
A constant for the checked attribute. |
static String |
CITE
Constant for element cite. |
static String |
CITE_ATT
A constant for the cite attribute. |
static String |
CLASS
A constant for the class attribute. |
static String |
CLASSID
A constant for the classid attribute. |
static String |
CODE
Constant for element code. |
static String |
CODEBASE
A constant for the codebase attribute. |
static String |
CODETYPE
A constant for the codetype attribute. |
static String |
COL
Constant for element col. |
static String |
COLGROUP
Constant for element colgroup. |
static String |
COLS
A constant for the cols attribute. |
static String |
COLSPAN
A constant for the colspan attribute. |
static String |
CONTENT
A constant for the content attribute. |
static String |
COORDS
A constant for the coords attribute. |
static String |
DATA
A constant for the data attribute. |
static String |
DATETIME
A constant for the datetime attribute. |
static String |
DD
Constant for element dd. |
static String |
DECLARE
A constant for the declare attribute. |
static String |
DEFER
A constant for the defer attribute. |
static String |
DEL
Constant for element del. |
static String |
DFN
Constant for element dfn. |
static String |
DIR
Constant for element dir. |
static String |
DIR_ATT
A constant for the dir attribute. |
static String |
DISABLED
A constant for the disabled attribute. |
static String |
DIV
Constant for element div. |
static String |
DL
Constant for element dl. |
static String |
DT
Constant for element dt. |
static String |
EM
Constant for element em. |
static String |
ENCTYPE
A constant for the enctype attribute. |
static String |
FIELDSET
Constant for element fieldset. |
static String |
FONT
Constant for element font. |
static String |
FOR
A constant for the for attribute. |
static String |
FORM
Constant for element form. |
static String |
FRAME
Constant for element frame. |
static String |
FRAME_ATT
A constant for the frame attribute. |
static String |
FRAMESET
Constant for element frameset. |
static String |
H1
Constant for element h1. |
static String |
H2
Constant for element h2. |
static String |
H3
Constant for element h3. |
static String |
H4
Constant for element h4. |
static String |
H5
Constant for element h5. |
static String |
H6
Constant for element h6. |
static String |
HEAD
Constant for element head. |
static String |
HEADERS
A constant for the headers attribute. |
static String |
HEIGHT
A constant for the height attribute. |
static String |
HR
Constant for element hr. |
static String |
HREF
A constant for the href attribute. |
static String |
HREFLANG
A constant for the hreflang attribute. |
static String |
HTML
Constant for element html. |
static String |
HTTP_EQUIV
A constant for the http-equiv attribute. |
static String |
I
Constant for element i. |
static String |
ID
A constant for the id attribute. |
static String |
IFRAME
Constant for element iframe. |
static String |
IMG
Constant for element img. |
static String |
INPUT
Constant for element input. |
static String |
INS
Constant for element ins. |
static String |
ISMAP
A constant for the ismap attribute. |
static String |
KBD
Constant for element kbd. |
static String |
LABEL
Constant for element label. |
static String |
LABEL_ATT
A constant for the label attribute. |
static String |
LANG
A constant for the lang attribute. |
static String |
LEGEND
Constant for element legend. |
static String |
LI
Constant for element li. |
static String |
LINK
Constant for element link. |
static String |
LONGDESC
A constant for the longdesc attribute. |
static String |
MAP
Constant for element map. |
static String |
MAXLENGTH
A constant for the maxlength attribute. |
static String |
MEDIA
A constant for the media attribute. |
static String |
MENU
Constant for element menu. |
static String |
META
Constant for element meta. |
static String |
METHOD
A constant for the method attribute. |
static String |
MULTIPLE
A constant for the multiple attribute. |
static String |
NAME
A constant for the name attribute. |
static String |
NOFRAMES
Constant for element noframes. |
static String |
NOHREF
A constant for the nohref attribute. |
static String |
NOSCRIPT
Constant for element noscript. |
static String |
OBJECT
Constant for element object. |
static String |
OL
Constant for element ol. |
static String |
ONBLUR
A constant for the onblur attribute. |
static String |
ONCHANGE
A constant for the onchange attribute. |
static String |
ONCLICK
A constant for the onclick attribute. |
static String |
ONDBLCLICK
A constant for the ondblclick attribute. |
static String |
ONFOCUS
A constant for the onfocus attribute. |
static String |
ONKEYDOWN
A constant for the onkeydown attribute. |
static String |
ONKEYPRESS
A constant for the onkeypress attribute. |
static String |
ONKEYUP
A constant for the onkeyup attribute. |
static String |
ONLOAD
A constant for the onload attribute. |
static String |
ONMOUSEDOWN
A constant for the onmousedown attribute. |
static String |
ONMOUSEMOVE
A constant for the onmousemove attribute. |
static String |
ONMOUSEOUT
A constant for the onmouseout attribute. |
static String |
ONMOUSEOVER
A constant for the onmouseover attribute. |
static String |
ONMOUSEUP
A constant for the onmouseup attribute. |
static String |
ONRESET
A constant for the onreset attribute. |
static String |
ONSELECT
A constant for the onselect attribute. |
static String |
ONSUBMIT
A constant for the onsubmit attribute. |
static String |
ONUNLOAD
A constant for the onunload attribute. |
static String |
OPTGROUP
Constant for element optgroup. |
static String |
OPTION
Constant for element option. |
static String |
P
Constant for element p. |
static String |
PARAM
Constant for element param. |
static String |
PRE
Constant for element pre. |
static String |
PROFILE
A constant for the profile attribute. |
static String |
Q
Constant for element q. |
static String |
READONLY
A constant for the readonly attribute. |
static String |
REL
A constant for the rel attribute. |
static String |
REV
A constant for the rev attribute. |
static String |
ROWS
A constant for the rows attribute. |
static String |
ROWSPAN
A constant for the rowspan attribute. |
static String |
RULES
A constant for the rules attribute. |
static String |
S
Constant for element s. |
static String |
SAMP
Constant for element samp. |
static String |
SCHEME
A constant for the scheme attribute. |
static String |
SCOPE
A constant for the scope attribute. |
static String |
SCRIPT
Constant for element script. |
static String |
SELECT
Constant for element select. |
static String |
SELECTED
A constant for the selected attribute. |
static String |
SHAPE
A constant for the shape attribute. |
static String |
SIZE
A constant for the size attribute. |
static String |
SMALL
Constant for element small. |
static String |
SPAN
Constant for element span. |
static String |
SPAN_ATT
A constant for the span attribute. |
static String |
SRC
A constant for the src attribute. |
static String |
STANDBY
A constant for the standby attribute. |
static String |
STRIKE
Constant for element strike. |
static String |
STRONG
Constant for element strong. |
static String |
STYLE
Constant for element style. |
static String |
STYLE_ATT
A constant for the style attribute. |
static String |
SUB
Constant for element sub. |
static String |
SUMMARY
A constant for the summary attribute. |
static String |
SUP
Constant for element sup. |
static String |
TABINDEX
A constant for the tabindex attribute. |
static String |
TABLE
Constant for element table. |
static String |
TBODY
Constant for element tbody. |
static String |
TD
Constant for element td. |
static String |
TEXTAREA
Constant for element textarea. |
static String |
TFOOT
Constant for element tfoot. |
static String |
TH
Constant for element th. |
static String |
THEAD
Constant for element thead. |
static String |
TITLE
Constant for element title. |
static String |
TITLE_ATT
A constant for the title attribute. |
static String |
TR
Constant for element tr. |
static String |
TT
Constant for element tt. |
static String |
TYPE
A constant for the type attribute. |
static String |
U
Constant for element u. |
static String |
UL
Constant for element ul. |
static String |
USEMAP
A constant for the usemap attribute. |
static String |
VALIGN
A constant for the valign attribute. |
static String |
VALUE
A constant for the value attribute. |
static String |
VALUETYPE
A constant for the valuetype attribute. |
static String |
VAR
Constant for element var. |
static String |
WIDTH
A constant for the width attribute. |
static String |
XML_LANG
A constant for the xml:lang attribute. |
static String |
XML_SPACE
A constant for the xml:space attribute. |
static String |
XMLNS
A constant for the xmlns attribute. |
| Fields inherited from class com.aliasi.xml.SimpleElementHandler |
|---|
CDATA_ATTS_TYPE, EMPTY_ATTS, NO_OP_DEFAULT_HANDLER |
| Constructor Summary | |
|---|---|
XHtmlWriter()
|
|
XHtmlWriter(OutputStream out,
String charsetName)
|
|
| Method Summary | |
|---|---|
void |
a()
Start an a element with no attributes. |
void |
a(Attributes atts)
Start an a element with the specified
attributes. |
void |
a(String att,
String val)
Start an a element with the specified
attribute and value. |
void |
a(String att1,
String val1,
String att2,
String val2)
Start an a element with the specified
attributes and values. |
void |
a(String att1,
String val1,
String att2,
String val2,
String att3,
String val3)
Start an a element with the specified
attributes and values. |
void |
a(String att1,
String val1,
String att2,
String val2,
String att3,
String val3,
String att4,
String val4)
Start an a element with the specified
attributes and values. |
void |
abbr()
Start an abbr element with no attributes. |
void |
abbr(Attributes atts)
Start an abbr element with the specified
attributes. |
void |
abbr(String att,
String val)
Start an abbr element with the specified
attribute and value. |
void |
abbr(String att1,
String val1,
String att2,
String val2)
Start an abbr element with the specified
attributes and values. |
void |
abbr(String att1,
String val1,
String att2,
String val2,
String att3,
String val3)
Start an abbr element with the specified
attributes and values. |
void |
abbr(String att1,
String val1,
String att2,
String val2,
String att3,
String val3,
String att4,
String val4)
Start an abbr element with the specified
attributes and values. |
void |
acronym()
Start an acronym element with no attributes. |
void |
acronym(Attributes atts)
Start an acronym element with the specified
attributes. |
void |
acronym(String att,
String val)
Start an acronym element with the specified
attribute and value. |
void |
acronym(String att1,
String val1,
String att2,
String val2)
Start an acronym element with the specified
attributes and values. |
void |
acronym(String att1,
String val1,
String att2,
String val2,
String att3,
String val3)
Start an acronym element with the specified
attributes and values. |
void |
acronym(String att1,
String val1,
String att2,
String val2,
String att3,
String val3,
String att4,
String val4)
Start an acronym element with the specified
attributes and values. |
void |
address()
Start an address element with no attributes. |
void |
address(Attributes atts)
Start an address element with the specified
attributes. |
void |
address(String att,
String val)
Start an address element with the specified
attribute and value. |
void |
address(String att1,
String val1,
String att2,
String val2)
Start an address element with the specified
attributes and values. |
void |
address(String att1,
String val1,
String att2,
String val2,
String att3,
String val3)
Start an address element with the specified
attributes and values. |
void |
address(String att1,
String val1,
String att2,
String val2,
String att3,
String val3,
String att4,
String val4)
Start an address element with the specified
attributes and values. |
void |
applet()
Start an applet element with no attributes. |
void |
applet(Attributes atts)
Start an applet element with the specified
attributes. |
void |
applet(String att,
String val)
Start an applet element with the specified
attribute and value. |
void |
applet(String att1,
String val1,
String att2,
String val2)
Start an applet element with the specified
attributes and values. |
void |
applet(String att1,
String val1,
String att2,
String val2,
String att3,
String val3)
Start an applet element with the specified
attributes and values. |
void |
applet(String att1,
String val1,
String att2,
String val2,
String att3,
String val3,
String att4,
String val4)
Start an applet element with the specified
attributes and values. |
void |
area()
Start an area element with no attributes. |
void |
area(Attributes atts)
Start an area element with the specified
attributes. |
void |
area(String att,
String val)
Start a |