net.sourceforge.blogentis.utils
Class JTidyService
java.lang.Object
org.apache.turbine.services.BaseInitable
org.apache.turbine.services.BaseService
org.apache.turbine.services.TurbineBaseService
net.sourceforge.blogentis.utils.JTidyService
- All Implemented Interfaces:
- org.apache.turbine.services.Initable, org.apache.turbine.services.Service
- public class JTidyService
- extends org.apache.turbine.services.TurbineBaseService
Service that handles cleaning up HTML with JTidy.
- Author:
- abas
Fields inherited from class org.apache.turbine.services.BaseService |
configuration, name, serviceBroker |
Fields inherited from class org.apache.turbine.services.BaseInitable |
initableBroker, isInitialized |
Method Summary |
static java.lang.String |
cleanupString(java.lang.String orig)
Clean us the given string according to JTidy rules and return the
pretty-printed version. |
static JTidyService |
getInstane()
|
static org.w3c.tidy.Tidy |
getTidy()
|
void |
init()
|
static org.w3c.dom.Node |
parseHTMLToDOM(java.lang.String html)
Parse the given HTML fragment and produce the cleaned-up DOM tree. |
void |
shutdown()
|
Methods inherited from class org.apache.turbine.services.TurbineBaseService |
init, init, init |
Methods inherited from class org.apache.turbine.services.BaseService |
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker |
Methods inherited from class org.apache.turbine.services.BaseInitable |
getInit, getInitableBroker, setInit, setInitableBroker |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.turbine.services.Initable |
getInit, setInitableBroker |
DEFAULT_CONFIGURATION
public static final java.lang.String DEFAULT_CONFIGURATION
- See Also:
- Constant Field Values
CONFIGURATION_PARAMETER
public static final java.lang.String CONFIGURATION_PARAMETER
- See Also:
- Constant Field Values
SERVICE_NAME
public static final java.lang.String SERVICE_NAME
- See Also:
- Constant Field Values
JTidyService
public JTidyService()
getInstane
public static JTidyService getInstane()
init
public void init()
shutdown
public void shutdown()
getTidy
public static org.w3c.tidy.Tidy getTidy()
parseHTMLToDOM
public static org.w3c.dom.Node parseHTMLToDOM(java.lang.String html)
- Parse the given HTML fragment and produce the cleaned-up DOM tree.
- Parameters:
html
- the HTML fragment
- Returns:
- the BODY element of the parsed HTML document. Its children will
be tags, text will be wrapped in paragraph tags.
cleanupString
public static java.lang.String cleanupString(java.lang.String orig)
throws java.io.UnsupportedEncodingException
- Clean us the given string according to JTidy rules and return the
pretty-printed version.
- Parameters:
orig
- the original HTML fragment string.
- Returns:
- the pretty-printed HTML string.
- Throws:
java.io.UnsupportedEncodingException
- When the UTF-8 encoding does not exist.
Copyright © 2003-2004 SourceForge.net. All Rights Reserved.