net.sourceforge.blogentis.utils
Class JTidyService

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended bynet.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

Field Summary
static java.lang.String CONFIGURATION_PARAMETER
           
static java.lang.String DEFAULT_CONFIGURATION
           
static java.lang.String SERVICE_NAME
           
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Constructor Summary
JTidyService()
           
 
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
 

Field Detail

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
Constructor Detail

JTidyService

public JTidyService()
Method Detail

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.