public class Tidy
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private static java.util.Map |
CMDLINE_ALIAS
Alias for configuration options accepted in command line.
|
private Configuration |
configuration |
private java.io.PrintWriter |
errout
Error output stream.
|
private java.lang.String |
inputStreamName |
private int |
parseErrors |
private int |
parseWarnings |
private Report |
report |
(package private) static long |
serialVersionUID
Serial Version UID to avoid problems during serialization.
|
private java.io.PrintWriter |
stderr |
Constructor and Description |
---|
Tidy()
Instantiates a new Tidy instance.
|
Modifier and Type | Method and Description |
---|---|
static org.w3c.dom.Document |
createEmptyDocument()
Creates an empty DOM Document.
|
java.lang.String |
getAltText()
alt-text - default text for alt attribute. |
boolean |
getAsciiChars()
ascii-chars - convert quotes and dashes to nearest ASCII char. |
boolean |
getBreakBeforeBR()
break-before-br - output newline before <br>.
|
boolean |
getBurstSlides()
split - create slides on each h2 element. |
Configuration |
getConfiguration()
Returns the actual configuration
|
java.lang.String |
getDocType()
doctype - user specified doctype. |
boolean |
getDropEmptyParas()
drop-empty-paras - discard empty p elements. |
boolean |
getDropFontTags()
drop-font-tags - discard presentation tags. |
boolean |
getDropProprietaryAttributes()
drop-proprietary-attributes - discard proprietary attributes. |
boolean |
getEmacs()
gnu-emacs - if true format error output for GNU Emacs. |
boolean |
getEncloseBlockText()
enclose-block-text - if true text in blocks is wrapped in <p>'s. |
boolean |
getEncloseText()
enclose-text - if true text at body is wrapped in <p>'s. |
java.lang.String |
getErrfile()
Errfile - file name to write errors to.
|
java.io.PrintWriter |
getErrout()
Errout - the error output stream.
|
boolean |
getEscapeCdata()
escape-cdata -replace CDATA sections with escaped text. |
boolean |
getFixBackslash()
fix-backslash - fix URLs by replacing \ with /. |
boolean |
getFixComments()
fix-bad-comments - fix comments with adjacent hyphens. |
boolean |
getFixUri()
fix-uri - output BODY content only. |
boolean |
getForceOutput()
force-output - output document even if errors were found. |
boolean |
getHideComments()
hide-comments - hides all (real) comments in output. |
boolean |
getHideEndTags()
hide-endtags - suppress optional end tags.
|
boolean |
getIndentAttributes()
indent-attributes - newline+indent before each attribute. |
boolean |
getIndentCdata()
indent-cdata - indent CDATA sections. |
boolean |
getIndentContent()
indent - indent content of appropriate tags.
|
java.lang.String |
getInputEncoding()
input-encoding the character encoding used for input. |
java.lang.String |
getInputStreamName() |
boolean |
getJoinClasses()
join-classes - join multiple class attributes. |
boolean |
getJoinStyles()
join-styles - join multiple style attributes. |
boolean |
getKeepFileTimes()
keep-time - if true last modified time is preserved. |
boolean |
getLiteralAttribs()
literal-attributes - if true attributes may use newlines. |
boolean |
getLogicalEmphasis()
logical-emphasis - replace i by em and b by strong. |
boolean |
getLowerLiterals()
lower-literals - folds known attribute values to lower case. |
boolean |
getMakeBare()
make-clean - remove Microsoft cruft.
|
boolean |
getMakeClean()
make-clean - remove presentational clutter.
|
boolean |
getNumEntities()
numeric-entities - output entities other than the built-in HTML entities in the numeric rather
than the named entity form. |
boolean |
getOnlyErrors()
only-errors - if true normal output is suppressed.
|
java.lang.String |
getOutputEncoding()
output-encoding the character encoding used for output. |
int |
getParseErrors()
ParseErrors - the number of errors that occurred in the most recent parse operation.
|
int |
getParseWarnings()
ParseWarnings - the number of warnings that occurred in the most recent parse operation.
|
boolean |
getPrintBodyOnly()
print-body-only - output BODY content only. |
boolean |
getQuiet()
quiet - no 'Parsing X', guessed DTD or summary.
|
boolean |
getQuoteAmpersand()
quote-ampersand - output naked ampersand as &. |
boolean |
getQuoteMarks()
quote-marks - output " marks as ". |
boolean |
getQuoteNbsp()
quote-nbsp - output non-breaking space as entity. |
boolean |
getRawOut()
output-raw - avoid mapping values > 127 to entities. |
int |
getRepeatedAttributes()
repeated-attributes - keep first or last duplicate attribute. |
boolean |
getReplaceColor()
replace-color - replace hex color attribute values with names. |
int |
getShowErrors()
show-errors - number of errors to put out. |
boolean |
getShowWarnings()
show-warnings - show warnings? (errors are always shown).
|
boolean |
getSmartIndent()
SmartIndent - does text/block level content effect indentation.
|
int |
getSpaces()
indent-spaces - default indentation. |
java.io.PrintWriter |
getStderr() |
int |
getTabsize()
tab-size - tab size in chars. |
boolean |
getTidyMark()
tidy-mark - add meta element indicating tidied doc. |
boolean |
getTrimEmptyElements()
trim-empty-elements - trim empty elements. |
boolean |
getUpperCaseAttrs()
uppercase-attributes - output attributes in upper case.
|
boolean |
getUpperCaseTags()
uppercase-tags - output tags in upper case.
|
boolean |
getWord2000()
word-2000 - draconian cleaning for Word2000. |
boolean |
getWrapAsp()
wrap-asp - wrap within ASP pseudo elements. |
boolean |
getWrapAttVals()
wrap-attributes - wrap within attribute values. |
boolean |
getWrapJste()
wrap-jste - wrap within JSTE pseudo elements. |
int |
getWraplen()
wrap - default wrap margin. |
boolean |
getWrapPhp()
wrap-php - wrap within PHP pseudo elements. |
boolean |
getWrapScriptlets()
wrap-script-literals - wrap within JavaScript string literals. |
boolean |
getWrapSection()
wrap-sections - wrap within <![ ... |
boolean |
getWriteback()
writeback - if true then output tidied markup.
|
boolean |
getXHTML()
output-xhtml - output extensible HTML.
|
boolean |
getXmlOut()
output-xml - create output as XML.
|
boolean |
getXmlPi()
add-xml-pi - add <?xml?> for XML docs. |
boolean |
getXmlPIs()
assume-xml-procins This option specifies if Tidy should change the parsing of processing
instructions to require ?> as the terminator rather than >. |
boolean |
getXmlSpace()
add-xml-space - if set to yes adds xml:space attr as needed. |
boolean |
getXmlTags()
input-xml - treat input as XML.
|
static void |
main(java.lang.String[] argv)
Command line interface to parser and pretty printer.
|
protected int |
mainExec(java.lang.String[] argv)
Main method, but returns the return code as an int instead of calling System.exit(code).
|
Node |
parse(java.io.InputStream in,
java.io.OutputStream out)
Reads from the given input and returns the root Node.
|
private Node |
parse(java.io.InputStream in,
java.lang.String file,
java.io.OutputStream out)
Internal routine that actually does the parsing.
|
Node |
parse(java.io.InputStream in,
java.io.Writer out)
Reads from the given input and returns the root Node.
|
Node |
parse(java.io.Reader in,
java.io.OutputStream out)
Reads from the given input and returns the root Node.
|
Node |
parse(java.io.Reader in,
java.io.Writer out)
Reads from the given input and returns the root Node.
|
private Node |
parse(StreamIn streamIn,
Out o)
Internal routine that actually does the parsing.
|
org.w3c.dom.Document |
parseDOM(java.io.InputStream in,
java.io.OutputStream out)
Parses InputStream in and returns a DOM Document node.
|
org.w3c.dom.Document |
parseDOM(java.io.Reader in,
java.io.Writer out) |
void |
pprint(org.w3c.dom.Document doc,
java.io.OutputStream out)
Pretty-prints a DOM Document.
|
void |
pprint(org.w3c.dom.Node node,
java.io.OutputStream out)
Pretty-prints a DOM Node.
|
private void |
pprint(Node node,
java.io.OutputStream out)
Pretty-prints a tidy Node.
|
void |
setAltText(java.lang.String altText)
alt-text - default text for alt attribute. |
void |
setAsciiChars(boolean asciiChars)
ascii-chars - convert quotes and dashes to nearest ASCII char. |
void |
setBreakBeforeBR(boolean breakBeforeBR)
break-before-br - output newline before <br>.
|
void |
setBurstSlides(boolean burstSlides)
split - create slides on each h2 element. |
void |
setConfigurationFromFile(java.lang.String filename)
Sets the configuration from a configuration file.
|
void |
setConfigurationFromProps(java.util.Properties props)
Sets the configuration from a properties object.
|
void |
setDocType(java.lang.String doctype)
doctype - user specified doctype. |
void |
setDropEmptyParas(boolean dropEmptyParas)
drop-empty-paras - discard empty p elements. |
void |
setDropFontTags(boolean dropFontTags)
drop-font-tags - discard presentation tags. |
void |
setDropProprietaryAttributes(boolean dropProprietaryAttributes)
drop-proprietary-attributes - discard proprietary attributes. |
void |
setEmacs(boolean emacs)
gnu-emacs - if true format error output for GNU Emacs. |
void |
setEncloseBlockText(boolean encloseBlockText)
enclose-block-text - if true text in blocks is wrapped in <p>'s. |
void |
setEncloseText(boolean encloseText)
enclose-text - if true text at body is wrapped in <p>'s. |
void |
setErrfile(java.lang.String errfile)
Errfile - file name to write errors to.
|
void |
setErrout(java.io.PrintWriter out) |
void |
setEscapeCdata(boolean escapeCdata)
escape-cdata - replace CDATA sections with escaped text. |
void |
setFixBackslash(boolean fixBackslash)
fix-backslash - fix URLs by replacing \ with /. |
void |
setFixComments(boolean fixComments)
fix-bad-comments - fix comments with adjacent hyphens. |
void |
setFixUri(boolean fixUri)
fix-uri - fix uri references applying URI encoding if necessary. |
void |
setForceOutput(boolean forceOutput)
force-output - output document even if errors were found. |
void |
setHideComments(boolean hideComments)
hide-comments - hides all (real) comments in output. |
void |
setHideEndTags(boolean hideEndTags)
hide-endtags - suppress optional end tags.
|
void |
setIndentAttributes(boolean indentAttributes)
indent-attributes - newline+indent before each attribute. |
void |
setIndentCdata(boolean indentCdata)
indent-cdata - indent CDATA sections. |
void |
setIndentContent(boolean indentContent)
indent - indent content of appropriate tags.
|
void |
setInputEncoding(java.lang.String encoding)
input-encoding the character encoding used for input. |
void |
setInputStreamName(java.lang.String name)
InputStreamName - the name of the input stream (printed in the header information).
|
void |
setJoinClasses(boolean joinClasses)
join-classes - join multiple class attributes. |
void |
setJoinStyles(boolean joinStyles)
join-styles - join multiple style attributes. |
void |
setKeepFileTimes(boolean keepFileTimes)
keep-time - if true last modified time is preserved. |
void |
setLiteralAttribs(boolean literalAttribs)
literal-attributes - if true attributes may use newlines. |
void |
setLogicalEmphasis(boolean logicalEmphasis)
logical-emphasis - replace i by em and b by strong. |
void |
setLowerLiterals(boolean lowerLiterals)
lower-literals - folds known attribute values to lower case. |
void |
setMakeBare(boolean makeBare)
make-bare - remove Microsoft cruft.
|
void |
setMakeClean(boolean makeClean)
make-clean - remove presentational clutter.
|
void |
setMessageListener(TidyMessageListener listener)
Attach a TidyMessageListener which will be notified for messages and errors.
|
void |
setNumEntities(boolean numEntities)
numeric-entities - output entities other than the built-in HTML entities in the numeric rather
than the named entity form. |
void |
setOnlyErrors(boolean onlyErrors)
only-errors - if true normal output is suppressed.
|
void |
setOutputEncoding(java.lang.String encoding)
output-encoding the character encoding used for output. |
void |
setPrintBodyOnly(boolean bodyOnly)
print-body-only - output BODY content only. |
void |
setQuiet(boolean quiet)
quiet - no 'Parsing X', guessed DTD or summary.
|
void |
setQuoteAmpersand(boolean quoteAmpersand)
quote-ampersand - output naked ampersand as &. |
void |
setQuoteMarks(boolean quoteMarks)
quote-marks - output " marks as ". |
void |
setQuoteNbsp(boolean quoteNbsp)
quote-nbsp - output non-breaking space as entity. |
void |
setRawOut(boolean rawOut)
output-raw - avoid mapping values > 127 to entities. |
void |
setRepeatedAttributes(int repeatedAttributes)
repeated-attributes - keep first or last duplicate attribute. |
void |
setReplaceColor(boolean replaceColor)
replace-color - replace hex color attribute values with names. |
void |
setShowErrors(int showErrors)
show-errors - set the number of errors to put out. |
void |
setShowWarnings(boolean showWarnings)
show-warnings - show warnings? (errors are always shown).
|
void |
setSmartIndent(boolean smartIndent)
SmartIndent - does text/block level content effect indentation.
|
void |
setSpaces(int spaces)
indent-spaces - default indentation. |
void |
setTabsize(int tabsize)
tab-size - tab size in chars. |
void |
setTidyMark(boolean tidyMark)
tidy-mark - add meta element indicating tidied doc. |
void |
setTrimEmptyElements(boolean trimEmpty)
trim-empty-elements - trim empty elements. |
void |
setUpperCaseAttrs(boolean upperCaseAttrs)
uppercase-attributes - output attributes in upper case.
|
void |
setUpperCaseTags(boolean upperCaseTags)
uppercase-tags - output tags in upper case.
|
void |
setWord2000(boolean word2000)
word-2000 - draconian cleaning for Word2000. |
void |
setWrapAsp(boolean wrapAsp)
wrap-asp - wrap within ASP pseudo elements. |
void |
setWrapAttVals(boolean wrapAttVals)
wrap-attributes - wrap within attribute values. |
void |
setWrapJste(boolean wrapJste)
wrap-jste - wrap within JSTE pseudo elements. |
void |
setWraplen(int wraplen)
wrap - default wrap margin. |
void |
setWrapPhp(boolean wrapPhp)
wrap-php - wrap within PHP pseudo elements. |
void |
setWrapScriptlets(boolean wrapScriptlets)
wrap-script-literals - wrap within JavaScript string literals. |
void |
setWrapSection(boolean wrapSection)
wrap-sections - wrap within <![ ... |
void |
setWriteback(boolean writeback)
writeback - if true then output tidied markup.
|
void |
setXHTML(boolean xhtml)
output-xhtml - output extensible HTML.
|
void |
setXmlOut(boolean xmlOut)
output-xml - create output as XML.
|
void |
setXmlPi(boolean xmlPi)
add-xml-pi - add <?xml?> for XML docs. |
void |
setXmlPIs(boolean xmlPIs)
assume-xml-procins This option specifies if Tidy should change the parsing of processing
instructions to require ?> as the terminator rather than >. |
void |
setXmlSpace(boolean xmlSpace)
add-xml-space - if set to yes adds xml:space attr as needed. |
void |
setXmlTags(boolean xmlTags)
input-xml - treat input as XML.
|
static final long serialVersionUID
private static final java.util.Map CMDLINE_ALIAS
private java.io.PrintWriter errout
private java.io.PrintWriter stderr
private Configuration configuration
private java.lang.String inputStreamName
private int parseErrors
private int parseWarnings
private Report report
public Tidy()
public Configuration getConfiguration()
public java.io.PrintWriter getStderr()
public int getParseErrors()
public int getParseWarnings()
public void setInputStreamName(java.lang.String name)
name
- input stream namepublic java.lang.String getInputStreamName()
public java.io.PrintWriter getErrout()
public void setErrout(java.io.PrintWriter out)
public void setConfigurationFromFile(java.lang.String filename)
filename
- configuration file name/path.public void setConfigurationFromProps(java.util.Properties props)
props
- Properties objectpublic static org.w3c.dom.Document createEmptyDocument()
public Node parse(java.io.InputStream in, java.io.OutputStream out)
in
- inputout
- optional destination for pretty-printed documentpublic Node parse(java.io.Reader in, java.io.OutputStream out)
in
- inputout
- optional destination for pretty-printed documentpublic Node parse(java.io.Reader in, java.io.Writer out)
in
- inputout
- optional destination for pretty-printed documentpublic Node parse(java.io.InputStream in, java.io.Writer out)
in
- inputout
- optional destination for pretty-printed documentpublic org.w3c.dom.Document parseDOM(java.io.InputStream in, java.io.OutputStream out)
in
- input streamout
- optional output streampublic org.w3c.dom.Document parseDOM(java.io.Reader in, java.io.Writer out)
public void pprint(org.w3c.dom.Document doc, java.io.OutputStream out)
doc
- org.w3c.dom.Documentout
- output streampublic void pprint(org.w3c.dom.Node node, java.io.OutputStream out)
node
- org.w3c.dom.Node. Must be an instance of org.w3c.tidy.DOMNodeImpl.out
- output streamprivate Node parse(StreamIn streamIn, Out o)
streamIn
- tidy StreamIno
- tidy Outprivate Node parse(java.io.InputStream in, java.lang.String file, java.io.OutputStream out) throws java.io.FileNotFoundException, java.io.IOException
in
- input stream (used only if file
is null)file
- file nameout
- output streamjava.io.FileNotFoundException
- if file
is not null but it can't be foundjava.io.IOException
- for errors in reading input stream or fileprivate void pprint(Node node, java.io.OutputStream out)
node
- org.w3c.tidy.Nodeout
- output streampublic static void main(java.lang.String[] argv)
argv
- command line parametersprotected int mainExec(java.lang.String[] argv)
argv
- command line parameterspublic void setMessageListener(TidyMessageListener listener)
listener
- TidyMessageListener implementationpublic void setSpaces(int spaces)
indent-spaces
- default indentation.spaces
- number of spaces used for indentationConfiguration.spaces
public int getSpaces()
indent-spaces
- default indentation.Configuration.spaces
public void setWraplen(int wraplen)
wrap
- default wrap margin.wraplen
- default wrap marginConfiguration.wraplen
public int getWraplen()
wrap
- default wrap margin.Configuration.wraplen
public void setTabsize(int tabsize)
tab-size
- tab size in chars.tabsize
- tab size in charsConfiguration.tabsize
public int getTabsize()
tab-size
- tab size in chars.Configuration.tabsize
public void setErrfile(java.lang.String errfile)
errfile
- file name to write errors toConfiguration.errfile
public java.lang.String getErrfile()
Configuration.errfile
public void setWriteback(boolean writeback)
writeback
- true
= output tidied markupConfiguration.writeback
public boolean getWriteback()
true
if tidy will output tidied markup in input fileConfiguration.writeback
public void setOnlyErrors(boolean onlyErrors)
onlyErrors
- if true
normal output is suppressed.Configuration.onlyErrors
public boolean getOnlyErrors()
true
if normal output is suppressed.Configuration.onlyErrors
public void setShowWarnings(boolean showWarnings)
showWarnings
- if false
warnings are not shownConfiguration.showWarnings
public boolean getShowWarnings()
false
if warnings are not shownConfiguration.showWarnings
public void setQuiet(boolean quiet)
quiet
- true
= don't output summary, warnings or errorsConfiguration.quiet
public boolean getQuiet()
true
if tidy will not output summary, warnings or errorsConfiguration.quiet
public void setIndentContent(boolean indentContent)
indentContent
- indent content of appropriate tagsConfiguration.indentContent
public boolean getIndentContent()
true
if tidy will indent content of appropriate tagsConfiguration.indentContent
public void setSmartIndent(boolean smartIndent)
smartIndent
- true
if text/block level content should effect indentationConfiguration.smartIndent
public boolean getSmartIndent()
true
if text/block level content should effect indentationConfiguration.smartIndent
public void setHideEndTags(boolean hideEndTags)
hideEndTags
- true
= suppress optional end tagsConfiguration.hideEndTags
public boolean getHideEndTags()
true
if tidy will suppress optional end tagsConfiguration.hideEndTags
public void setXmlTags(boolean xmlTags)
xmlTags
- true
if tidy should treat input as XMLConfiguration.xmlTags
public boolean getXmlTags()
true
if tidy will treat input as XMLConfiguration.xmlTags
public void setXmlOut(boolean xmlOut)
xmlOut
- true
if tidy should create output as xmlConfiguration.xmlOut
public boolean getXmlOut()
true
if tidy will create output as xmlConfiguration.xmlOut
public void setXHTML(boolean xhtml)
xhtml
- true
if tidy should output XHTMLConfiguration.xHTML
public boolean getXHTML()
true
if tidy will output XHTMLConfiguration.xHTML
public void setUpperCaseTags(boolean upperCaseTags)
upperCaseTags
- true
if tidy should output tags in upper case (default is lowercase)Configuration.upperCaseTags
public boolean getUpperCaseTags()
true
if tidy should will tags in upper caseConfiguration.upperCaseTags
public void setUpperCaseAttrs(boolean upperCaseAttrs)
upperCaseAttrs
- true
if tidy should output attributes in upper case (default is lowercase)Configuration.upperCaseAttrs
public boolean getUpperCaseAttrs()
true
if tidy should will attributes in upper caseConfiguration.upperCaseAttrs
public void setMakeClean(boolean makeClean)
makeClean
- true to remove presentational clutterConfiguration.makeClean
public boolean getMakeClean()
Configuration.makeClean
public void setMakeBare(boolean makeBare)
makeBare
- true to remove Microsoft cruftConfiguration.makeBare
public boolean getMakeBare()
Configuration.makeBare
public void setBreakBeforeBR(boolean breakBeforeBR)
breakBeforeBR
- true
if tidy should output a newline before <br>Configuration.breakBeforeBR
public boolean getBreakBeforeBR()
true
if tidy will output a newline before <br>Configuration.breakBeforeBR
public void setBurstSlides(boolean burstSlides)
split
- create slides on each h2 element.burstSlides
- true
if tidy should create slides on each h2 elementConfiguration.burstSlides
public boolean getBurstSlides()
split
- create slides on each h2 element.true
if tidy will create slides on each h2 elementConfiguration.burstSlides
public void setNumEntities(boolean numEntities)
numeric-entities
- output entities other than the built-in HTML entities in the numeric rather
than the named entity form.numEntities
- true
if tidy should output entities in the numeric form.Configuration.numEntities
public boolean getNumEntities()
numeric-entities
- output entities other than the built-in HTML entities in the numeric rather
than the named entity form.true
if tidy will output entities in the numeric form.Configuration.numEntities
public void setQuoteMarks(boolean quoteMarks)
quote-marks
- output " marks as ".quoteMarks
- true
if tidy should output " marks as "Configuration.quoteMarks
public boolean getQuoteMarks()
quote-marks
- output " marks as ".true
if tidy will output " marks as "Configuration.quoteMarks
public void setQuoteNbsp(boolean quoteNbsp)
quote-nbsp
- output non-breaking space as entity.quoteNbsp
- true
if tidy should output non-breaking space as entityConfiguration.quoteNbsp
public boolean getQuoteNbsp()
quote-nbsp
- output non-breaking space as entity.true
if tidy will output non-breaking space as entityConfiguration.quoteNbsp
public void setQuoteAmpersand(boolean quoteAmpersand)
quote-ampersand
- output naked ampersand as &.quoteAmpersand
- true
if tidy should output naked ampersand as &Configuration.quoteAmpersand
public boolean getQuoteAmpersand()
quote-ampersand
- output naked ampersand as &.true
if tidy will output naked ampersand as &Configuration.quoteAmpersand
public void setWrapAttVals(boolean wrapAttVals)
wrap-attributes
- wrap within attribute values.wrapAttVals
- true
if tidy should wrap within attribute valuesConfiguration.wrapAttVals
public boolean getWrapAttVals()
wrap-attributes
- wrap within attribute values.true
if tidy will wrap within attribute valuesConfiguration.wrapAttVals
public void setWrapScriptlets(boolean wrapScriptlets)
wrap-script-literals
- wrap within JavaScript string literals.wrapScriptlets
- true
if tidy should wrap within JavaScript string literalsConfiguration.wrapScriptlets
public boolean getWrapScriptlets()
wrap-script-literals
- wrap within JavaScript string literals.true
if tidy will wrap within JavaScript string literalsConfiguration.wrapScriptlets
public void setWrapSection(boolean wrapSection)
wrap-sections
- wrap within <![ ... ]> section tagswrapSection
- true
if tidy should wrap within <![ ... ]> section tagsConfiguration.wrapSection
public boolean getWrapSection()
wrap-sections
- wrap within <![ ... ]> section tagstrue
if tidy will wrap within <![ ... ]> section tagsConfiguration.wrapSection
public void setAltText(java.lang.String altText)
alt-text
- default text for alt attribute.altText
- default text for alt attributeConfiguration.altText
public java.lang.String getAltText()
alt-text
- default text for alt attribute.Configuration.altText
public void setXmlPi(boolean xmlPi)
add-xml-pi
- add <?xml?> for XML docs.xmlPi
- true
if tidy should add <?xml?> for XML docsConfiguration.xmlPi
public boolean getXmlPi()
add-xml-pi
- add <?xml?> for XML docs.true
if tidy will add <?xml?> for XML docsConfiguration.xmlPi
public void setDropFontTags(boolean dropFontTags)
drop-font-tags
- discard presentation tags.dropFontTags
- true
if tidy should discard presentation tagsConfiguration.dropFontTags
public boolean getDropFontTags()
drop-font-tags
- discard presentation tags.true
if tidy will discard presentation tagsConfiguration.dropFontTags
public void setDropProprietaryAttributes(boolean dropProprietaryAttributes)
drop-proprietary-attributes
- discard proprietary attributes.dropProprietaryAttributes
- true
if tidy should discard proprietary attributesConfiguration.dropProprietaryAttributes
public boolean getDropProprietaryAttributes()
drop-proprietary-attributes
- discard proprietary attributes.true
if tidy will discard proprietary attributesConfiguration.dropProprietaryAttributes
public void setDropEmptyParas(boolean dropEmptyParas)
drop-empty-paras
- discard empty p elements.dropEmptyParas
- true
if tidy should discard empty p elementsConfiguration.dropEmptyParas
public boolean getDropEmptyParas()
drop-empty-paras
- discard empty p elements.true
if tidy will discard empty p elementsConfiguration.dropEmptyParas
public void setFixComments(boolean fixComments)
fix-bad-comments
- fix comments with adjacent hyphens.fixComments
- true
if tidy should fix comments with adjacent hyphensConfiguration.fixComments
public boolean getFixComments()
fix-bad-comments
- fix comments with adjacent hyphens.true
if tidy will fix comments with adjacent hyphensConfiguration.fixComments
public void setWrapAsp(boolean wrapAsp)
wrap-asp
- wrap within ASP pseudo elements.wrapAsp
- true
if tidy should wrap within ASP pseudo elementsConfiguration.wrapAsp
public boolean getWrapAsp()
wrap-asp
- wrap within ASP pseudo elements.true
if tidy will wrap within ASP pseudo elementsConfiguration.wrapAsp
public void setWrapJste(boolean wrapJste)
wrap-jste
- wrap within JSTE pseudo elements.wrapJste
- true
if tidy should wrap within JSTE pseudo elementsConfiguration.wrapJste
public boolean getWrapJste()
wrap-jste
- wrap within JSTE pseudo elements.true
if tidy will wrap within JSTE pseudo elementsConfiguration.wrapJste
public void setWrapPhp(boolean wrapPhp)
wrap-php
- wrap within PHP pseudo elements.wrapPhp
- true
if tidy should wrap within PHP pseudo elementsConfiguration.wrapPhp
public boolean getWrapPhp()
wrap-php
- wrap within PHP pseudo elements.true
if tidy will wrap within PHP pseudo elementsConfiguration.wrapPhp
public void setFixBackslash(boolean fixBackslash)
fix-backslash
- fix URLs by replacing \ with /.fixBackslash
- true
if tidy should fix URLs by replacing \ with /Configuration.fixBackslash
public boolean getFixBackslash()
fix-backslash
- fix URLs by replacing \ with /.true
if tidy will fix URLs by replacing \ with /Configuration.fixBackslash
public void setIndentAttributes(boolean indentAttributes)
indent-attributes
- newline+indent before each attribute.indentAttributes
- true
if tidy should output a newline+indent before each attributeConfiguration.indentAttributes
public boolean getIndentAttributes()
indent-attributes
- newline+indent before each attribute.true
if tidy will output a newline+indent before each attributeConfiguration.indentAttributes
public void setDocType(java.lang.String doctype)
doctype
- user specified doctype.doctype
- omit | auto | strict | loose | fpi
where the fpi is a string
similar to "-//ACME//DTD HTML 3.14159//EN" Note: for fpi include the double-quotes in the
string.Configuration.docTypeStr
,
Configuration.docTypeMode
public java.lang.String getDocType()
doctype
- user specified doctype.omit | auto | strict | loose | fpi
where the fpi is a string similar
to "-//ACME//DTD HTML 3.14159//EN" Note: for fpi include the double-quotes in the string.Configuration.docTypeStr
,
Configuration.docTypeMode
public void setLogicalEmphasis(boolean logicalEmphasis)
logical-emphasis
- replace i by em and b by strong.logicalEmphasis
- true
if tidy should replace i by em and b by strongConfiguration.logicalEmphasis
public boolean getLogicalEmphasis()
logical-emphasis
- replace i by em and b by strong.true
if tidy will replace i by em and b by strongConfiguration.logicalEmphasis
public void setXmlPIs(boolean xmlPIs)
assume-xml-procins
This option specifies if Tidy should change the parsing of processing
instructions to require ?> as the terminator rather than >. This option is automatically set if the input is in
XML.xmlPIs
- true
if tidy should expect a ?> at the end of processing instructionsConfiguration.xmlPIs
public boolean getXmlPIs()
assume-xml-procins
This option specifies if Tidy should change the parsing of processing
instructions to require ?> as the terminator rather than >. This option is automatically set if the input is in
XML.true
if tidy will expect a ?> at the end of processing instructionsConfiguration.xmlPIs
public void setEncloseText(boolean encloseText)
enclose-text
- if true text at body is wrapped in <p>'s.encloseText
- true
if tidy should wrap text at body in <p>'s.Configuration.encloseBodyText
public boolean getEncloseText()
enclose-text
- if true text at body is wrapped in <p>'s.true
if tidy will wrap text at body in <p>'s.Configuration.encloseBodyText
public void setEncloseBlockText(boolean encloseBlockText)
enclose-block-text
- if true text in blocks is wrapped in <p>'s.encloseBlockText
- true
if tidy should wrap text text in blocks in <p>'s.Configuration.encloseBlockText
public boolean getEncloseBlockText()
enclose-block-text
- if true text in blocks is wrapped in <p>'s. return true
if tidy should will text text in blocks in <p>'s.Configuration.encloseBlockText
public void setWord2000(boolean word2000)
word-2000
- draconian cleaning for Word2000.word2000
- true
if tidy should clean word2000 documentsConfiguration.word2000
public boolean getWord2000()
word-2000
- draconian cleaning for Word2000.true
if tidy will clean word2000 documentsConfiguration.word2000
public void setTidyMark(boolean tidyMark)
tidy-mark
- add meta element indicating tidied doc.tidyMark
- true
if tidy should add meta element indicating tidied docConfiguration.tidyMark
public boolean getTidyMark()
tidy-mark
- add meta element indicating tidied doc.true
if tidy will add meta element indicating tidied docConfiguration.tidyMark
public void setXmlSpace(boolean xmlSpace)
add-xml-space
- if set to yes adds xml:space attr as needed.xmlSpace
- true
if tidy should add xml:space attr as neededConfiguration.xmlSpace
public boolean getXmlSpace()
add-xml-space
- if set to yes adds xml:space attr as needed.true
if tidy will add xml:space attr as neededConfiguration.xmlSpace
public void setEmacs(boolean emacs)
gnu-emacs
- if true format error output for GNU Emacs.emacs
- true
if tidy should format error output for GNU EmacsConfiguration.emacs
public boolean getEmacs()
gnu-emacs
- if true format error output for GNU Emacs.true
if tidy will format error output for GNU EmacsConfiguration.emacs
public void setLiteralAttribs(boolean literalAttribs)
literal-attributes
- if true attributes may use newlines.literalAttribs
- true
if attributes may use newlinesConfiguration.literalAttribs
public boolean getLiteralAttribs()
literal-attributes
- if true attributes may use newlines.true
if attributes may use newlinesConfiguration.literalAttribs
public void setPrintBodyOnly(boolean bodyOnly)
print-body-only
- output BODY content only.bodyOnly
- true = print only the document bodyConfiguration.bodyOnly
public boolean getPrintBodyOnly()
print-body-only
- output BODY content only.public void setFixUri(boolean fixUri)
fix-uri
- fix uri references applying URI encoding if necessary.fixUri
- true = fix uri referencesConfiguration.fixUri
public boolean getFixUri()
fix-uri
- output BODY content only.public void setLowerLiterals(boolean lowerLiterals)
lower-literals
- folds known attribute values to lower case.lowerLiterals
- true = folds known attribute values to lower caseConfiguration.lowerLiterals
public boolean getLowerLiterals()
lower-literals
- folds known attribute values to lower case.public void setHideComments(boolean hideComments)
hide-comments
- hides all (real) comments in output.hideComments
- true = hides all comments in outputConfiguration.hideComments
public boolean getHideComments()
hide-comments
- hides all (real) comments in output.public void setIndentCdata(boolean indentCdata)
indent-cdata
- indent CDATA sections.indentCdata
- true = indent CDATA sectionsConfiguration.indentCdata
public boolean getIndentCdata()
indent-cdata
- indent CDATA sections.public void setForceOutput(boolean forceOutput)
force-output
- output document even if errors were found.forceOutput
- true = output document even if errors were foundConfiguration.forceOutput
public boolean getForceOutput()
force-output
- output document even if errors were found.public void setShowErrors(int showErrors)
show-errors
- set the number of errors to put out.showErrors
- number of errors to put outConfiguration.showErrors
public int getShowErrors()
show-errors
- number of errors to put out.public void setAsciiChars(boolean asciiChars)
ascii-chars
- convert quotes and dashes to nearest ASCII char.asciiChars
- true = convert quotes and dashes to nearest ASCII charConfiguration.asciiChars
public boolean getAsciiChars()
ascii-chars
- convert quotes and dashes to nearest ASCII char.public void setJoinClasses(boolean joinClasses)
join-classes
- join multiple class attributes.joinClasses
- true = join multiple class attributesConfiguration.joinClasses
public boolean getJoinClasses()
join-classes
- join multiple class attributes.public void setJoinStyles(boolean joinStyles)
join-styles
- join multiple style attributes.joinStyles
- true = join multiple style attributesConfiguration.joinStyles
public boolean getJoinStyles()
join-styles
- join multiple style attributes.public void setTrimEmptyElements(boolean trimEmpty)
trim-empty-elements
- trim empty elements.trim-empty-elements
- true = trim empty elementsConfiguration.trimEmpty
public boolean getTrimEmptyElements()
trim-empty-elements
- trim empty elements.public void setReplaceColor(boolean replaceColor)
replace-color
- replace hex color attribute values with names.replaceColor
- true = replace hex color attribute values with namesConfiguration.replaceColor
public boolean getReplaceColor()
replace-color
- replace hex color attribute values with names.public void setEscapeCdata(boolean escapeCdata)
escape-cdata
- replace CDATA sections with escaped text.escapeCdata
- true = replace CDATA sections with escaped textConfiguration.escapeCdata
public boolean getEscapeCdata()
escape-cdata
-replace CDATA sections with escaped text.public void setRepeatedAttributes(int repeatedAttributes)
repeated-attributes
- keep first or last duplicate attribute.repeatedAttributes
- Configuration.KEEP_FIRST | Configuration.KEEP_LAST
Configuration.duplicateAttrs
public int getRepeatedAttributes()
repeated-attributes
- keep first or last duplicate attribute.Configuration.KEEP_FIRST | Configuration.KEEP_LAST
public void setKeepFileTimes(boolean keepFileTimes)
keep-time
- if true last modified time is preserved.keepFileTimes
- true
if tidy should preserved last modified time in input file.Configuration.keepFileTimes
public boolean getKeepFileTimes()
keep-time
- if true last modified time is preserved.true
if tidy will preserved last modified time in input file.Configuration.keepFileTimes
public void setRawOut(boolean rawOut)
output-raw
- avoid mapping values > 127 to entities. This has the same effect of specifying a
"raw" encoding in the original version of tidy.rawOut
- avoid mapping values > 127 to entitiesConfiguration.rawOut
public boolean getRawOut()
output-raw
- avoid mapping values > 127 to entities.true
if tidy will not map values > 127 to entitiesConfiguration.rawOut
public void setInputEncoding(java.lang.String encoding)
input-encoding
the character encoding used for input.encoding
- a valid java encoding namepublic java.lang.String getInputEncoding()
input-encoding
the character encoding used for input.public void setOutputEncoding(java.lang.String encoding)
output-encoding
the character encoding used for output.encoding
- a valid java encoding namepublic java.lang.String getOutputEncoding()
output-encoding
the character encoding used for output.