public class XHTMLContentHandler extends SafeContentHandler
SafeContentHandler.Output
Modifier and Type | Field and Description |
---|---|
static Set<String> |
ENDLINE
The elements that get appended with the
NL character. |
static String |
XHTML
The XHTML namespace URI
|
Constructor and Description |
---|
XHTMLContentHandler(ContentHandler handler,
Metadata metadata) |
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
characters(String characters) |
void |
element(String name,
String value)
Emits an XHTML element with the given text content.
|
void |
endDocument()
Ends the XHTML document by writing the following footer and
clearing the namespace mappings:
|
void |
endElement(String name) |
void |
endElement(String uri,
String local,
String name)
Ends the given element.
|
protected boolean |
isInvalid(int ch)
Checks whether the given Unicode character is an invalid XML character
and should be replaced for output.
|
void |
newline() |
void |
startDocument()
Starts an XHTML document by setting up the namespace mappings
when called for the first time.
|
void |
startElement(String name) |
void |
startElement(String name,
AttributesImpl attributes) |
void |
startElement(String name,
String attribute,
String value) |
void |
startElement(String uri,
String local,
String name,
Attributes attributes)
Starts the given element.
|
ignorableWhitespace, writeReplacement
endPrefixMapping, handleException, processingInstruction, setContentHandler, setDocumentLocator, skippedEntity, startPrefixMapping, toString
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
public static final String XHTML
public XHTMLContentHandler(ContentHandler handler, Metadata metadata)
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class ContentHandlerDecorator
SAXException
public void endDocument() throws SAXException
</body> </html>
endDocument
in interface ContentHandler
endDocument
in class SafeContentHandler
SAXException
public void startElement(String uri, String local, String name, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class SafeContentHandler
SAXException
public void endElement(String uri, String local, String name) throws SAXException
endElement
in interface ContentHandler
endElement
in class SafeContentHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class SafeContentHandler
SAXException
public void startElement(String name) throws SAXException
SAXException
public void startElement(String name, String attribute, String value) throws SAXException
SAXException
public void startElement(String name, AttributesImpl attributes) throws SAXException
SAXException
public void endElement(String name) throws SAXException
SAXException
public void characters(String characters) throws SAXException
SAXException
public void newline() throws SAXException
SAXException
public void element(String name, String value) throws SAXException
name
- XHTML element namevalue
- element value, possibly null
SAXException
- if the content element could not be writtenprotected boolean isInvalid(int ch)
SafeContentHandler
Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
isInvalid
in class SafeContentHandler
ch
- charactertrue
if the character should be replaced,
false
otherwiseCopyright © 2007–2023 The Apache Software Foundation. All rights reserved.