org.xwiki.rendering.internal.parser.wikimodel.xhtml
Class XWikiXHTMLWhitespaceXMLFilter

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by org.wikimodel.wem.xhtml.filter.DefaultXMLFilter
          extended by org.wikimodel.wem.xhtml.filter.XHTMLWhitespaceXMLFilter
              extended by org.xwiki.rendering.internal.parser.wikimodel.xhtml.XWikiXHTMLWhitespaceXMLFilter
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler, org.xml.sax.XMLFilter, org.xml.sax.XMLReader

public class XWikiXHTMLWhitespaceXMLFilter
extends org.wikimodel.wem.xhtml.filter.XHTMLWhitespaceXMLFilter

Extension to the WikiModel XHTMLWhitespaceXMLFilter to support both the ability to not remove spaces inside XHTML elements containing wiki syntax (we only trim leading and trailing spaces) and to handle XWiki special XHTML comment placeholders (for recognizing links, images, etc).

Since:
2.1RC1
Version:
$Id$

Field Summary
static java.lang.String SAX_CONTAINS_WIKI_SYNTAX_PROPERTY
          The SAX property controlling whether XHTML elements can contain wiki syntax or not.
 
Fields inherited from class org.wikimodel.wem.xhtml.filter.DefaultXMLFilter
SAX_LEXICAL_HANDLER_PROPERTY
 
Constructor Summary
XWikiXHTMLWhitespaceXMLFilter(org.xml.sax.XMLReader reader)
          
 
Method Summary
protected  void cleanContentExtraWhiteSpaces()
          
 void endCDATA()
          
protected  boolean isSemanticComment(java.lang.String comment)
          
 void setProperty(java.lang.String name, java.lang.Object value)
          
protected  boolean shouldRemoveWhiteSpaces()
          
 
Methods inherited from class org.wikimodel.wem.xhtml.filter.XHTMLWhitespaceXMLFilter
appendInlineEvent, characters, comment, endDocument, endElement, endEmptyVisibleElement, endNonVisibleElement, flushContent, flushContent, getContent, sendCharacters, sendCharacters, sendInlineEvent, sendPreviousContent, startCDATA, startElement, startEmptyVisibleElement, startNonVisibleElement, trimLeadingWhiteSpaces, trimLeadingWhiteSpaces, trimTrailingWhiteSpaces, trimTrailingWhiteSpaces
 
Methods inherited from class org.wikimodel.wem.xhtml.filter.DefaultXMLFilter
endDTD, endEntity, getProperty, parse, startDTD, startEntity
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setParent, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SAX_CONTAINS_WIKI_SYNTAX_PROPERTY

public static final java.lang.String SAX_CONTAINS_WIKI_SYNTAX_PROPERTY
The SAX property controlling whether XHTML elements can contain wiki syntax or not. This controls the whitespace stripping behavior.

See Also:
Constant Field Values
Constructor Detail

XWikiXHTMLWhitespaceXMLFilter

public XWikiXHTMLWhitespaceXMLFilter(org.xml.sax.XMLReader reader)

See Also:
XHTMLWhitespaceXMLFilter.XHTMLWhitespaceXMLFilter(XMLReader)
Method Detail

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws org.xml.sax.SAXNotRecognizedException,
                        org.xml.sax.SAXNotSupportedException

Specified by:
setProperty in interface org.xml.sax.XMLReader
Overrides:
setProperty in class org.wikimodel.wem.xhtml.filter.DefaultXMLFilter
Throws:
org.xml.sax.SAXNotRecognizedException
org.xml.sax.SAXNotSupportedException
See Also:
DefaultXMLFilter.setProperty(String, Object)

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException

Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler
Overrides:
endCDATA in class org.wikimodel.wem.xhtml.filter.XHTMLWhitespaceXMLFilter
Throws:
org.xml.sax.SAXException
See Also:
XHTMLWhitespaceXMLFilter.endCDATA()

shouldRemoveWhiteSpaces

protected boolean shouldRemoveWhiteSpaces()

Overrides:
shouldRemoveWhiteSpaces in class org.wikimodel.wem.xhtml.filter.XHTMLWhitespaceXMLFilter
See Also:
XHTMLWhitespaceXMLFilter.shouldRemoveWhiteSpaces()

cleanContentExtraWhiteSpaces

protected void cleanContentExtraWhiteSpaces()

Overrides:
cleanContentExtraWhiteSpaces in class org.wikimodel.wem.xhtml.filter.XHTMLWhitespaceXMLFilter
See Also:
XHTMLWhitespaceXMLFilter.cleanContentExtraWhiteSpaces()

isSemanticComment

protected boolean isSemanticComment(java.lang.String comment)

Overrides:
isSemanticComment in class org.wikimodel.wem.xhtml.filter.XHTMLWhitespaceXMLFilter
See Also:
XHTMLWhitespaceXMLFilter.isSemanticComment(String)


Copyright © 2004-2011 XWiki. All Rights Reserved.