org.xwiki.rendering.internal.renderer.printer
Class XHTMLWriter

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by org.dom4j.io.XMLWriter
          extended by org.xwiki.rendering.internal.renderer.printer.XHTMLWriter
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler, XMLFilter, XMLReader

public class XHTMLWriter
extends org.dom4j.io.XMLWriter

XHTMLWriter is an helper to configure XMLWriter to format a DOM4J tree as XHTML.

Version:
$Id$

Field Summary
protected static org.dom4j.io.OutputFormat DEFAULT_XHTML_FORMAT
           
 
Fields inherited from class org.dom4j.io.XMLWriter
DEFAULT_FORMAT, lastOutputNodeType, LEXICAL_HANDLER_NAMES, preserve, writer
 
Constructor Summary
XHTMLWriter(Writer writer)
           
 
Method Summary
protected  String escapeAttributeEntities(String text)
          Escapes a string to be used as an attribute value.
 
Methods inherited from class org.dom4j.io.XMLWriter
characters, close, comment, createWriter, defaultMaximumAllowedCharacter, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, escapeElementEntities, flush, getLexicalHandler, getMaximumAllowedCharacter, getOutputFormat, getProperty, handleException, ignorableWhitespace, indent, installLexicalHandler, isElementSpacePreserved, isEscapeText, isExpandEmptyElements, isNamespaceDeclaration, notationDecl, parse, println, processingInstruction, resolveEntityRefs, setDocumentLocator, setEscapeText, setIndentLevel, setLexicalHandler, setMaximumAllowedCharacter, setOutputStream, setProperty, setResolveEntityRefs, setWriter, shouldEncodeChar, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, write, write, write, write, write, write, write, write, write, write, write, write, write, writeAttribute, writeAttribute, writeAttributes, writeAttributes, writeCDATA, writeClose, writeClose, writeComment, writeDeclaration, writeDocType, writeDocType, writeElement, writeElementContent, writeEmptyElementClose, writeEntity, writeEntityRef, writeEscapeAttributeEntities, writeNamespace, writeNamespace, writeNamespaces, writeNode, writeNodeText, writeOpen, writePrintln, writeProcessingInstruction, writeString
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, parse, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_XHTML_FORMAT

protected static final org.dom4j.io.OutputFormat DEFAULT_XHTML_FORMAT
Constructor Detail

XHTMLWriter

public XHTMLWriter(Writer writer)
            throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException
Method Detail

escapeAttributeEntities

protected String escapeAttributeEntities(String text)
Escapes a string to be used as an attribute value. Unlike the original method in XMLWriter, apostrophes are replaced by a numerical entity &, since ' is not valid in HTML documents.

Overrides:
escapeAttributeEntities in class org.dom4j.io.XMLWriter
Parameters:
text - the attribute value to escape
Returns:
the text with all occurrences of special XML characters replaced by entity references.


Copyright © 2004-2011 XWiki. All Rights Reserved.