org.apache.camel.dataformat.tagsoup
Class TidyMarkupDataFormat

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

public class TidyMarkupDataFormat
extends Object
implements org.apache.camel.spi.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(org.apache.camel.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(org.apache.camel.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(org.apache.camel.Exchange exchange,
                    Object object,
                    OutputStream outputStream)
             throws Exception
Unsupported operation. We cannot create ugly HTML.

Specified by:
marshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

unmarshal

public Object unmarshal(org.apache.camel.Exchange exchange,
                        InputStream inputStream)
                 throws Exception
Unmarshal the data

Specified by:
unmarshal in interface org.apache.camel.spi.DataFormat
Throws:
Exception

asStringTidyMarkup

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

Parameters:
inputStream -
Returns:
String of XML
Throws:
org.apache.camel.CamelException

asNodeTidyMarkup

public Node asNodeTidyMarkup(InputStream inputStream)
                      throws org.apache.camel.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:
org.apache.camel.CamelException

createTagSoupParser

protected XMLReader createTagSoupParser()
                                 throws org.apache.camel.CamelException
Create the tagSoup Parser

Returns:
Throws:
org.apache.camel.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