org.apache.camel.dataformat.tagsoup
Class TidyMarkupDataFormat

java.lang.Object
  extended by org.apache.camel.dataformat.tagsoup.TidyMarkupDataFormat
All Implemented Interfaces:
DataFormat

public class TidyMarkupDataFormat
extends Object
implements DataFormat

Dataformat for TidyMarkup (aka Well formed HTML in XML form.. may or may not be XHTML) This dataformat is intended to convert bad HTML from a site (or file) into a well formed HTML document which can then be sent to XSLT or xpath'ed on.


Constructor Summary
TidyMarkupDataFormat()
           
 
Method Summary
 Node asNodeTidyMarkup(InputStream inputStream)
          Return the HTML Markup as an Node
 String asStringTidyMarkup(InputStream inputStream)
          Return the tidy markup as a string
protected  ContentHandler createContentHandler(Writer w)
           
protected  XMLReader createTagSoupParser()
          Create the tagSoup Parser
 Class getDataObjectType()
           
 String getMethod()
           
 Map<String,Boolean> getParserFeatures()
           
 Map<String,Object> getParserPropeties()
           
 org.ccil.cowan.tagsoup.Schema getParsingSchema()
           
 void marshal(Exchange exchange, Object object, OutputStream outputStream)
          Unsupported operation.
 void setDataObjectType(Class dataObjectType)
           
 void setMethod(String method)
           
 void setParserFeatures(Map<String,Boolean> parserFeatures)
           
 void setParserPropeties(Map<String,Object> parserPropeties)
           
 void setParsingSchema(org.ccil.cowan.tagsoup.Schema schema)
           
 Object unmarshal(Exchange exchange, InputStream inputStream)
          Unmarshal the data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TidyMarkupDataFormat

public TidyMarkupDataFormat()
Method Detail

marshal

public void marshal(Exchange exchange,
                    Object object,
                    OutputStream outputStream)
             throws Exception
Unsupported operation. We cannot create ugly HTML.

Specified by:
marshal in interface DataFormat
Parameters:
exchange - the current exchange
object - the object to be marshalled
outputStream - the output stream to write the marshalled result to
Throws:
Exception - can be thrown

unmarshal

public Object unmarshal(Exchange exchange,
                        InputStream inputStream)
                 throws Exception
Unmarshal the data

Specified by:
unmarshal in interface DataFormat
Parameters:
exchange - the current exchange
inputStream - the input stream with the object to be unmarshalled
Returns:
the unmarshalled object
Throws:
Exception

asStringTidyMarkup

public String asStringTidyMarkup(InputStream inputStream)
                          throws CamelException
Return the tidy markup as a string

Parameters:
inputStream -
Returns:
String of XML
Throws:
CamelException

asNodeTidyMarkup

public Node asNodeTidyMarkup(InputStream inputStream)
                      throws CamelException
Return the HTML Markup as an Node

Parameters:
inputStream - The input Stream to convert
Returns:
org.w3c.dom.Node The HTML Markup as a DOM Node
Throws:
CamelException

createTagSoupParser

protected XMLReader createTagSoupParser()
                                 throws CamelException
Create the tagSoup Parser

Returns:
Throws:
CamelException

setParsingSchema

public void setParsingSchema(org.ccil.cowan.tagsoup.Schema schema)
Parameters:
htmlSchema - the htmlSchema to set

getParsingSchema

public org.ccil.cowan.tagsoup.Schema getParsingSchema()
Returns:
the htmlSchema

createContentHandler

protected ContentHandler createContentHandler(Writer w)

setParserFeatures

public void setParserFeatures(Map<String,Boolean> parserFeatures)
Parameters:
parserFeatures - the parserFeatures to set

getParserFeatures

public Map<String,Boolean> getParserFeatures()
Returns:
the parserFeatures

setParserPropeties

public void setParserPropeties(Map<String,Object> parserPropeties)
Parameters:
parserPropeties - the parserPropeties to set

getParserPropeties

public Map<String,Object> getParserPropeties()
Returns:
the parserPropeties

setMethod

public void setMethod(String method)
Parameters:
method - the method to set

getMethod

public String getMethod()
Returns:
the method

getDataObjectType

public Class getDataObjectType()
Returns:
the dataObjectType

setDataObjectType

public void setDataObjectType(Class dataObjectType)
Parameters:
dataObjectType - the dataObjectType to set


Apache CAMEL