Package org.w3c.tidy
Class Tidy
- java.lang.Object
-
- org.w3c.tidy.Tidy
-
- All Implemented Interfaces:
java.io.Serializable
public class Tidy extends java.lang.Object implements java.io.SerializableHTML parser and pretty printer.- Version:
- $Revision: 1191 $ ($Author: aditsu $)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.MapCMDLINE_ALIASAlias for configuration options accepted in command line.private Configurationconfigurationprivate java.io.PrintWritererroutError output stream.private java.lang.StringinputStreamNameprivate intparseErrorsprivate intparseWarningsprivate Reportreport(package private) static longserialVersionUIDSerial Version UID to avoid problems during serialization.private java.io.PrintWriterstderr
-
Constructor Summary
Constructors Constructor Description Tidy()Instantiates a new Tidy instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static org.w3c.dom.DocumentcreateEmptyDocument()Creates an empty DOM Document.java.lang.StringgetAltText()alt-text- default text for alt attribute.booleangetAsciiChars()ascii-chars- convert quotes and dashes to nearest ASCII char.booleangetBreakBeforeBR()break-before-br - output newline before <br>.booleangetBurstSlides()split- create slides on each h2 element.ConfigurationgetConfiguration()Returns the actual configurationjava.lang.StringgetDocType()doctype- user specified doctype.booleangetDropEmptyParas()drop-empty-paras- discard empty p elements.booleangetDropFontTags()drop-font-tags- discard presentation tags.booleangetDropProprietaryAttributes()drop-proprietary-attributes- discard proprietary attributes.booleangetEmacs()gnu-emacs- if true format error output for GNU Emacs.booleangetEncloseBlockText()enclose-block-text- if true text in blocks is wrapped in <p>'s.booleangetEncloseText()enclose-text- if true text at body is wrapped in <p>'s.java.lang.StringgetErrfile()Errfile - file name to write errors to.java.io.PrintWritergetErrout()Errout - the error output stream.booleangetEscapeCdata()escape-cdata-replace CDATA sections with escaped text.booleangetFixBackslash()fix-backslash- fix URLs by replacing \ with /.booleangetFixComments()fix-bad-comments- fix comments with adjacent hyphens.booleangetFixUri()fix-uri- output BODY content only.booleangetForceOutput()force-output- output document even if errors were found.booleangetHideComments()hide-comments- hides all (real) comments in output.booleangetHideEndTags()hide-endtags - suppress optional end tags.booleangetIndentAttributes()indent-attributes- newline+indent before each attribute.booleangetIndentCdata()indent-cdata- indent CDATA sections.booleangetIndentContent()indent - indent content of appropriate tags.java.lang.StringgetInputEncoding()input-encodingthe character encoding used for input.java.lang.StringgetInputStreamName()booleangetJoinClasses()join-classes- join multiple class attributes.booleangetJoinStyles()join-styles- join multiple style attributes.booleangetKeepFileTimes()keep-time- if true last modified time is preserved.booleangetLiteralAttribs()literal-attributes- if true attributes may use newlines.booleangetLogicalEmphasis()logical-emphasis- replace i by em and b by strong.booleangetLowerLiterals()lower-literals- folds known attribute values to lower case.booleangetMakeBare()make-clean - remove Microsoft cruft.booleangetMakeClean()make-clean - remove presentational clutter.booleangetNumEntities()numeric-entities- output entities other than the built-in HTML entities in the numeric rather than the named entity form.booleangetOnlyErrors()only-errors - if true normal output is suppressed.java.lang.StringgetOutputEncoding()output-encodingthe character encoding used for output.intgetParseErrors()ParseErrors - the number of errors that occurred in the most recent parse operation.intgetParseWarnings()ParseWarnings - the number of warnings that occurred in the most recent parse operation.booleangetPrintBodyOnly()print-body-only- output BODY content only.booleangetQuiet()quiet - no 'Parsing X', guessed DTD or summary.booleangetQuoteAmpersand()quote-ampersand- output naked ampersand as &.booleangetQuoteMarks()quote-marks- output " marks as ".booleangetQuoteNbsp()quote-nbsp- output non-breaking space as entity.booleangetRawOut()output-raw- avoid mapping values > 127 to entities.intgetRepeatedAttributes()repeated-attributes- keep first or last duplicate attribute.booleangetReplaceColor()replace-color- replace hex color attribute values with names.intgetShowErrors()show-errors- number of errors to put out.booleangetShowWarnings()show-warnings - show warnings? (errors are always shown).booleangetSmartIndent()SmartIndent - does text/block level content effect indentation.intgetSpaces()indent-spaces- default indentation.java.io.PrintWritergetStderr()intgetTabsize()tab-size- tab size in chars.booleangetTidyMark()tidy-mark- add meta element indicating tidied doc.booleangetTrimEmptyElements()trim-empty-elements- trim empty elements.booleangetUpperCaseAttrs()uppercase-attributes - output attributes in upper case.booleangetUpperCaseTags()uppercase-tags - output tags in upper case.booleangetWord2000()word-2000- draconian cleaning for Word2000.booleangetWrapAsp()wrap-asp- wrap within ASP pseudo elements.booleangetWrapAttVals()wrap-attributes- wrap within attribute values.booleangetWrapJste()wrap-jste- wrap within JSTE pseudo elements.intgetWraplen()wrap- default wrap margin.booleangetWrapPhp()wrap-php- wrap within PHP pseudo elements.booleangetWrapScriptlets()wrap-script-literals- wrap within JavaScript string literals.booleangetWrapSection()wrap-sections- wrap within <![ ...booleangetWriteback()writeback - if true then output tidied markup.booleangetXHTML()output-xhtml - output extensible HTML.booleangetXmlOut()output-xml - create output as XML.booleangetXmlPi()add-xml-pi- add <?xml?> for XML docs.booleangetXmlPIs()assume-xml-procinsThis option specifies if Tidy should change the parsing of processing instructions to require ?> as the terminator rather than >.booleangetXmlSpace()add-xml-space- if set to yes adds xml:space attr as needed.booleangetXmlTags()input-xml - treat input as XML.static voidmain(java.lang.String[] argv)Command line interface to parser and pretty printer.protected intmainExec(java.lang.String[] argv)Main method, but returns the return code as an int instead of calling System.exit(code).Nodeparse(java.io.InputStream in, java.io.OutputStream out)Reads from the given input and returns the root Node.Nodeparse(java.io.InputStream in, java.io.Writer out)Reads from the given input and returns the root Node.private Nodeparse(java.io.InputStream in, java.lang.String file, java.io.OutputStream out)Internal routine that actually does the parsing.Nodeparse(java.io.Reader in, java.io.OutputStream out)Reads from the given input and returns the root Node.Nodeparse(java.io.Reader in, java.io.Writer out)Reads from the given input and returns the root Node.private Nodeparse(StreamIn streamIn, Out o)Internal routine that actually does the parsing.org.w3c.dom.DocumentparseDOM(java.io.InputStream in, java.io.OutputStream out)Parses InputStream in and returns a DOM Document node.org.w3c.dom.DocumentparseDOM(java.io.Reader in, java.io.Writer out)voidpprint(org.w3c.dom.Document doc, java.io.OutputStream out)Pretty-prints a DOM Document.voidpprint(org.w3c.dom.Node node, java.io.OutputStream out)Pretty-prints a DOM Node.private voidpprint(Node node, java.io.OutputStream out)Pretty-prints a tidy Node.voidsetAltText(java.lang.String altText)alt-text- default text for alt attribute.voidsetAsciiChars(boolean asciiChars)ascii-chars- convert quotes and dashes to nearest ASCII char.voidsetBreakBeforeBR(boolean breakBeforeBR)break-before-br - output newline before <br>.voidsetBurstSlides(boolean burstSlides)split- create slides on each h2 element.voidsetConfigurationFromFile(java.lang.String filename)Sets the configuration from a configuration file.voidsetConfigurationFromProps(java.util.Properties props)Sets the configuration from a properties object.voidsetDocType(java.lang.String doctype)doctype- user specified doctype.voidsetDropEmptyParas(boolean dropEmptyParas)drop-empty-paras- discard empty p elements.voidsetDropFontTags(boolean dropFontTags)drop-font-tags- discard presentation tags.voidsetDropProprietaryAttributes(boolean dropProprietaryAttributes)drop-proprietary-attributes- discard proprietary attributes.voidsetEmacs(boolean emacs)gnu-emacs- if true format error output for GNU Emacs.voidsetEncloseBlockText(boolean encloseBlockText)enclose-block-text- if true text in blocks is wrapped in <p>'s.voidsetEncloseText(boolean encloseText)enclose-text- if true text at body is wrapped in <p>'s.voidsetErrfile(java.lang.String errfile)Errfile - file name to write errors to.voidsetErrout(java.io.PrintWriter out)voidsetEscapeCdata(boolean escapeCdata)escape-cdata- replace CDATA sections with escaped text.voidsetFixBackslash(boolean fixBackslash)fix-backslash- fix URLs by replacing \ with /.voidsetFixComments(boolean fixComments)fix-bad-comments- fix comments with adjacent hyphens.voidsetFixUri(boolean fixUri)fix-uri- fix uri references applying URI encoding if necessary.voidsetForceOutput(boolean forceOutput)force-output- output document even if errors were found.voidsetHideComments(boolean hideComments)hide-comments- hides all (real) comments in output.voidsetHideEndTags(boolean hideEndTags)hide-endtags - suppress optional end tags.voidsetIndentAttributes(boolean indentAttributes)indent-attributes- newline+indent before each attribute.voidsetIndentCdata(boolean indentCdata)indent-cdata- indent CDATA sections.voidsetIndentContent(boolean indentContent)indent - indent content of appropriate tags.voidsetInputEncoding(java.lang.String encoding)input-encodingthe character encoding used for input.voidsetInputStreamName(java.lang.String name)InputStreamName - the name of the input stream (printed in the header information).voidsetJoinClasses(boolean joinClasses)join-classes- join multiple class attributes.voidsetJoinStyles(boolean joinStyles)join-styles- join multiple style attributes.voidsetKeepFileTimes(boolean keepFileTimes)keep-time- if true last modified time is preserved.voidsetLiteralAttribs(boolean literalAttribs)literal-attributes- if true attributes may use newlines.voidsetLogicalEmphasis(boolean logicalEmphasis)logical-emphasis- replace i by em and b by strong.voidsetLowerLiterals(boolean lowerLiterals)lower-literals- folds known attribute values to lower case.voidsetMakeBare(boolean makeBare)make-bare - remove Microsoft cruft.voidsetMakeClean(boolean makeClean)make-clean - remove presentational clutter.voidsetMessageListener(TidyMessageListener listener)Attach a TidyMessageListener which will be notified for messages and errors.voidsetNumEntities(boolean numEntities)numeric-entities- output entities other than the built-in HTML entities in the numeric rather than the named entity form.voidsetOnlyErrors(boolean onlyErrors)only-errors - if true normal output is suppressed.voidsetOutputEncoding(java.lang.String encoding)output-encodingthe character encoding used for output.voidsetPrintBodyOnly(boolean bodyOnly)print-body-only- output BODY content only.voidsetQuiet(boolean quiet)quiet - no 'Parsing X', guessed DTD or summary.voidsetQuoteAmpersand(boolean quoteAmpersand)quote-ampersand- output naked ampersand as &.voidsetQuoteMarks(boolean quoteMarks)quote-marks- output " marks as ".voidsetQuoteNbsp(boolean quoteNbsp)quote-nbsp- output non-breaking space as entity.voidsetRawOut(boolean rawOut)output-raw- avoid mapping values > 127 to entities.voidsetRepeatedAttributes(int repeatedAttributes)repeated-attributes- keep first or last duplicate attribute.voidsetReplaceColor(boolean replaceColor)replace-color- replace hex color attribute values with names.voidsetShowErrors(int showErrors)show-errors- set the number of errors to put out.voidsetShowWarnings(boolean showWarnings)show-warnings - show warnings? (errors are always shown).voidsetSmartIndent(boolean smartIndent)SmartIndent - does text/block level content effect indentation.voidsetSpaces(int spaces)indent-spaces- default indentation.voidsetTabsize(int tabsize)tab-size- tab size in chars.voidsetTidyMark(boolean tidyMark)tidy-mark- add meta element indicating tidied doc.voidsetTrimEmptyElements(boolean trimEmpty)trim-empty-elements- trim empty elements.voidsetUpperCaseAttrs(boolean upperCaseAttrs)uppercase-attributes - output attributes in upper case.voidsetUpperCaseTags(boolean upperCaseTags)uppercase-tags - output tags in upper case.voidsetWord2000(boolean word2000)word-2000- draconian cleaning for Word2000.voidsetWrapAsp(boolean wrapAsp)wrap-asp- wrap within ASP pseudo elements.voidsetWrapAttVals(boolean wrapAttVals)wrap-attributes- wrap within attribute values.voidsetWrapJste(boolean wrapJste)wrap-jste- wrap within JSTE pseudo elements.voidsetWraplen(int wraplen)wrap- default wrap margin.voidsetWrapPhp(boolean wrapPhp)wrap-php- wrap within PHP pseudo elements.voidsetWrapScriptlets(boolean wrapScriptlets)wrap-script-literals- wrap within JavaScript string literals.voidsetWrapSection(boolean wrapSection)wrap-sections- wrap within <![ ...voidsetWriteback(boolean writeback)writeback - if true then output tidied markup.voidsetXHTML(boolean xhtml)output-xhtml - output extensible HTML.voidsetXmlOut(boolean xmlOut)output-xml - create output as XML.voidsetXmlPi(boolean xmlPi)add-xml-pi- add <?xml?> for XML docs.voidsetXmlPIs(boolean xmlPIs)assume-xml-procinsThis option specifies if Tidy should change the parsing of processing instructions to require ?> as the terminator rather than >.voidsetXmlSpace(boolean xmlSpace)add-xml-space- if set to yes adds xml:space attr as needed.voidsetXmlTags(boolean xmlTags)input-xml - treat input as XML.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
Serial Version UID to avoid problems during serialization.- See Also:
- Constant Field Values
-
CMDLINE_ALIAS
private static final java.util.Map CMDLINE_ALIAS
Alias for configuration options accepted in command line.
-
errout
private java.io.PrintWriter errout
Error output stream.
-
stderr
private java.io.PrintWriter stderr
-
configuration
private Configuration configuration
-
inputStreamName
private java.lang.String inputStreamName
-
parseErrors
private int parseErrors
-
parseWarnings
private int parseWarnings
-
report
private Report report
-
-
Method Detail
-
getConfiguration
public Configuration getConfiguration()
Returns the actual configuration- Returns:
- tidy configuration
-
getStderr
public java.io.PrintWriter getStderr()
-
getParseErrors
public int getParseErrors()
ParseErrors - the number of errors that occurred in the most recent parse operation.- Returns:
- number of errors that occurred in the most recent parse operation.
-
getParseWarnings
public int getParseWarnings()
ParseWarnings - the number of warnings that occurred in the most recent parse operation.- Returns:
- number of warnings that occurred in the most recent parse operation.
-
setInputStreamName
public void setInputStreamName(java.lang.String name)
InputStreamName - the name of the input stream (printed in the header information).- Parameters:
name- input stream name
-
getInputStreamName
public java.lang.String getInputStreamName()
-
getErrout
public java.io.PrintWriter getErrout()
Errout - the error output stream.- Returns:
- error output stream.
-
setErrout
public void setErrout(java.io.PrintWriter out)
-
setConfigurationFromFile
public void setConfigurationFromFile(java.lang.String filename)
Sets the configuration from a configuration file.- Parameters:
filename- configuration file name/path.
-
setConfigurationFromProps
public void setConfigurationFromProps(java.util.Properties props)
Sets the configuration from a properties object.- Parameters:
props- Properties object
-
createEmptyDocument
public static org.w3c.dom.Document createEmptyDocument()
Creates an empty DOM Document.- Returns:
- a new org.w3c.dom.Document
-
parse
public Node parse(java.io.InputStream in, java.io.OutputStream out)
Reads from the given input and returns the root Node. If out is non-null, pretty prints to out. Warning: caller is responsible for calling close() on input and output after calling this method.- Parameters:
in- inputout- optional destination for pretty-printed document- Returns:
- parsed org.w3c.tidy.Node
-
parse
public Node parse(java.io.Reader in, java.io.OutputStream out)
Reads from the given input and returns the root Node. If out is non-null, pretty prints to out. Warning: caller is responsible for calling close() on input and output after calling this method.- Parameters:
in- inputout- optional destination for pretty-printed document- Returns:
- parsed org.w3c.tidy.Node
-
parse
public Node parse(java.io.Reader in, java.io.Writer out)
Reads from the given input and returns the root Node. If out is non-null, pretty prints to out. Warning: caller is responsible for calling close() on input and output after calling this method.- Parameters:
in- inputout- optional destination for pretty-printed document- Returns:
- parsed org.w3c.tidy.Node
-
parse
public Node parse(java.io.InputStream in, java.io.Writer out)
Reads from the given input and returns the root Node. If out is non-null, pretty prints to out. Warning: caller is responsible for calling close() on input and output after calling this method.- Parameters:
in- inputout- optional destination for pretty-printed document- Returns:
- parsed org.w3c.tidy.Node
-
parseDOM
public org.w3c.dom.Document parseDOM(java.io.InputStream in, java.io.OutputStream out)Parses InputStream in and returns a DOM Document node. If out is non-null, pretty prints to OutputStream out.- Parameters:
in- input streamout- optional output stream- Returns:
- parsed org.w3c.dom.Document
-
parseDOM
public org.w3c.dom.Document parseDOM(java.io.Reader in, java.io.Writer out)
-
pprint
public void pprint(org.w3c.dom.Document doc, java.io.OutputStream out)Pretty-prints a DOM Document. Must be an instance of org.w3c.tidy.DOMDocumentImpl. Caller is responsible for closing the outputStream after calling this method.- Parameters:
doc- org.w3c.dom.Documentout- output stream
-
pprint
public void pprint(org.w3c.dom.Node node, java.io.OutputStream out)Pretty-prints a DOM Node. Caller is responsible for closing the outputStream after calling this method.- Parameters:
node- org.w3c.dom.Node. Must be an instance of org.w3c.tidy.DOMNodeImpl.out- output stream
-
parse
private Node parse(StreamIn streamIn, Out o)
Internal routine that actually does the parsing.- Parameters:
streamIn- tidy StreamIno- tidy Out- Returns:
- parsed org.w3c.tidy.Node
-
parse
private Node parse(java.io.InputStream in, java.lang.String file, java.io.OutputStream out) throws java.io.FileNotFoundException, java.io.IOException
Internal routine that actually does the parsing. The caller can pass either an InputStream or file name. If both are passed, the file name is preferred.- Parameters:
in- input stream (used only iffileis null)file- file nameout- output stream- Returns:
- parsed org.w3c.tidy.Node
- Throws:
java.io.FileNotFoundException- iffileis not null but it can't be foundjava.io.IOException- for errors in reading input stream or file
-
pprint
private void pprint(Node node, java.io.OutputStream out)
Pretty-prints a tidy Node.- Parameters:
node- org.w3c.tidy.Nodeout- output stream
-
main
public static void main(java.lang.String[] argv)
Command line interface to parser and pretty printer.- Parameters:
argv- command line parameters
-
mainExec
protected int mainExec(java.lang.String[] argv)
Main method, but returns the return code as an int instead of calling System.exit(code). Needed for testing main method without shutting down tests.- Parameters:
argv- command line parameters- Returns:
- return code
-
setMessageListener
public void setMessageListener(TidyMessageListener listener)
Attach a TidyMessageListener which will be notified for messages and errors.- Parameters:
listener- TidyMessageListener implementation
-
setSpaces
public void setSpaces(int spaces)
indent-spaces- default indentation.- Parameters:
spaces- number of spaces used for indentation- See Also:
Configuration.spaces
-
getSpaces
public int getSpaces()
indent-spaces- default indentation.- Returns:
- number of spaces used for indentation
- See Also:
Configuration.spaces
-
setWraplen
public void setWraplen(int wraplen)
wrap- default wrap margin.- Parameters:
wraplen- default wrap margin- See Also:
Configuration.wraplen
-
getWraplen
public int getWraplen()
wrap- default wrap margin.- Returns:
- default wrap margin
- See Also:
Configuration.wraplen
-
setTabsize
public void setTabsize(int tabsize)
tab-size- tab size in chars.- Parameters:
tabsize- tab size in chars- See Also:
Configuration.tabsize
-
getTabsize
public int getTabsize()
tab-size- tab size in chars.- Returns:
- tab size in chars
- See Also:
Configuration.tabsize
-
setErrfile
public void setErrfile(java.lang.String errfile)
Errfile - file name to write errors to.- Parameters:
errfile- file name to write errors to- See Also:
Configuration.errfile
-
getErrfile
public java.lang.String getErrfile()
Errfile - file name to write errors to.- Returns:
- error file name
- See Also:
Configuration.errfile
-
setWriteback
public void setWriteback(boolean writeback)
writeback - if true then output tidied markup. NOTE: this property is ignored when parsing from an InputStream.- Parameters:
writeback-true= output tidied markup- See Also:
Configuration.writeback
-
getWriteback
public boolean getWriteback()
writeback - if true then output tidied markup. NOTE: this property is ignored when parsing from an InputStream.- Returns:
trueif tidy will output tidied markup in input file- See Also:
Configuration.writeback
-
setOnlyErrors
public void setOnlyErrors(boolean onlyErrors)
only-errors - if true normal output is suppressed.- Parameters:
onlyErrors- iftruenormal output is suppressed.- See Also:
Configuration.onlyErrors
-
getOnlyErrors
public boolean getOnlyErrors()
only-errors - if true normal output is suppressed.- Returns:
trueif normal output is suppressed.- See Also:
Configuration.onlyErrors
-
setShowWarnings
public void setShowWarnings(boolean showWarnings)
show-warnings - show warnings? (errors are always shown).- Parameters:
showWarnings- iffalsewarnings are not shown- See Also:
Configuration.showWarnings
-
getShowWarnings
public boolean getShowWarnings()
show-warnings - show warnings? (errors are always shown).- Returns:
falseif warnings are not shown- See Also:
Configuration.showWarnings
-
setQuiet
public void setQuiet(boolean quiet)
quiet - no 'Parsing X', guessed DTD or summary.- Parameters:
quiet-true= don't output summary, warnings or errors- See Also:
Configuration.quiet
-
getQuiet
public boolean getQuiet()
quiet - no 'Parsing X', guessed DTD or summary.- Returns:
trueif tidy will not output summary, warnings or errors- See Also:
Configuration.quiet
-
setIndentContent
public void setIndentContent(boolean indentContent)
indent - indent content of appropriate tags.- Parameters:
indentContent- indent content of appropriate tags- See Also:
Configuration.indentContent
-
getIndentContent
public boolean getIndentContent()
indent - indent content of appropriate tags.- Returns:
trueif tidy will indent content of appropriate tags- See Also:
Configuration.indentContent
-
setSmartIndent
public void setSmartIndent(boolean smartIndent)
SmartIndent - does text/block level content effect indentation.- Parameters:
smartIndent-trueif text/block level content should effect indentation- See Also:
Configuration.smartIndent
-
getSmartIndent
public boolean getSmartIndent()
SmartIndent - does text/block level content effect indentation.- Returns:
trueif text/block level content should effect indentation- See Also:
Configuration.smartIndent
-
setHideEndTags
public void setHideEndTags(boolean hideEndTags)
hide-endtags - suppress optional end tags.- Parameters:
hideEndTags-true= suppress optional end tags- See Also:
Configuration.hideEndTags
-
getHideEndTags
public boolean getHideEndTags()
hide-endtags - suppress optional end tags.- Returns:
trueif tidy will suppress optional end tags- See Also:
Configuration.hideEndTags
-
setXmlTags
public void setXmlTags(boolean xmlTags)
input-xml - treat input as XML.- Parameters:
xmlTags-trueif tidy should treat input as XML- See Also:
Configuration.xmlTags
-
getXmlTags
public boolean getXmlTags()
input-xml - treat input as XML.- Returns:
trueif tidy will treat input as XML- See Also:
Configuration.xmlTags
-
setXmlOut
public void setXmlOut(boolean xmlOut)
output-xml - create output as XML.- Parameters:
xmlOut-trueif tidy should create output as xml- See Also:
Configuration.xmlOut
-
getXmlOut
public boolean getXmlOut()
output-xml - create output as XML.- Returns:
trueif tidy will create output as xml- See Also:
Configuration.xmlOut
-
setXHTML
public void setXHTML(boolean xhtml)
output-xhtml - output extensible HTML.- Parameters:
xhtml-trueif tidy should output XHTML- See Also:
Configuration.xHTML
-
getXHTML
public boolean getXHTML()
output-xhtml - output extensible HTML.- Returns:
trueif tidy will output XHTML- See Also:
Configuration.xHTML
-
setUpperCaseTags
public void setUpperCaseTags(boolean upperCaseTags)
uppercase-tags - output tags in upper case.- Parameters:
upperCaseTags-trueif tidy should output tags in upper case (default is lowercase)- See Also:
Configuration.upperCaseTags
-
getUpperCaseTags
public boolean getUpperCaseTags()
uppercase-tags - output tags in upper case.- Returns:
trueif tidy should will tags in upper case- See Also:
Configuration.upperCaseTags
-
setUpperCaseAttrs
public void setUpperCaseAttrs(boolean upperCaseAttrs)
uppercase-attributes - output attributes in upper case.- Parameters:
upperCaseAttrs-trueif tidy should output attributes in upper case (default is lowercase)- See Also:
Configuration.upperCaseAttrs
-
getUpperCaseAttrs
public boolean getUpperCaseAttrs()
uppercase-attributes - output attributes in upper case.- Returns:
trueif tidy should will attributes in upper case- See Also:
Configuration.upperCaseAttrs
-
setMakeClean
public void setMakeClean(boolean makeClean)
make-clean - remove presentational clutter.- Parameters:
makeClean- true to remove presentational clutter- See Also:
Configuration.makeClean
-
getMakeClean
public boolean getMakeClean()
make-clean - remove presentational clutter.- Returns:
- true if tidy will remove presentational clutter
- See Also:
Configuration.makeClean
-
setMakeBare
public void setMakeBare(boolean makeBare)
make-bare - remove Microsoft cruft.- Parameters:
makeBare- true to remove Microsoft cruft- See Also:
Configuration.makeBare
-
getMakeBare
public boolean getMakeBare()
make-clean - remove Microsoft cruft.- Returns:
- true if tidy will remove Microsoft cruft
- See Also:
Configuration.makeBare
-
setBreakBeforeBR
public void setBreakBeforeBR(boolean breakBeforeBR)
break-before-br - output newline before <br>.- Parameters:
breakBeforeBR-trueif tidy should output a newline before <br>- See Also:
Configuration.breakBeforeBR
-
getBreakBeforeBR
public boolean getBreakBeforeBR()
break-before-br - output newline before <br>.- Returns:
trueif tidy will output a newline before <br>- See Also:
Configuration.breakBeforeBR
-
setBurstSlides
public void setBurstSlides(boolean burstSlides)
split- create slides on each h2 element.- Parameters:
burstSlides-trueif tidy should create slides on each h2 element- See Also:
Configuration.burstSlides
-
getBurstSlides
public boolean getBurstSlides()
split- create slides on each h2 element.- Returns:
trueif tidy will create slides on each h2 element- See Also:
Configuration.burstSlides
-
setNumEntities
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.- Parameters:
numEntities-trueif tidy should output entities in the numeric form.- See Also:
Configuration.numEntities
-
getNumEntities
public boolean getNumEntities()
numeric-entities- output entities other than the built-in HTML entities in the numeric rather than the named entity form.- Returns:
trueif tidy will output entities in the numeric form.- See Also:
Configuration.numEntities
-
setQuoteMarks
public void setQuoteMarks(boolean quoteMarks)
quote-marks- output " marks as ".- Parameters:
quoteMarks-trueif tidy should output " marks as "- See Also:
Configuration.quoteMarks
-
getQuoteMarks
public boolean getQuoteMarks()
quote-marks- output " marks as ".- Returns:
trueif tidy will output " marks as "- See Also:
Configuration.quoteMarks
-
setQuoteNbsp
public void setQuoteNbsp(boolean quoteNbsp)
quote-nbsp- output non-breaking space as entity.- Parameters:
quoteNbsp-trueif tidy should output non-breaking space as entity- See Also:
Configuration.quoteNbsp
-
getQuoteNbsp
public boolean getQuoteNbsp()
quote-nbsp- output non-breaking space as entity.- Returns:
trueif tidy will output non-breaking space as entity- See Also:
Configuration.quoteNbsp
-
setQuoteAmpersand
public void setQuoteAmpersand(boolean quoteAmpersand)
quote-ampersand- output naked ampersand as &.- Parameters:
quoteAmpersand-trueif tidy should output naked ampersand as &- See Also:
Configuration.quoteAmpersand
-
getQuoteAmpersand
public boolean getQuoteAmpersand()
quote-ampersand- output naked ampersand as &.- Returns:
trueif tidy will output naked ampersand as &- See Also:
Configuration.quoteAmpersand
-
setWrapAttVals
public void setWrapAttVals(boolean wrapAttVals)
wrap-attributes- wrap within attribute values.- Parameters:
wrapAttVals-trueif tidy should wrap within attribute values- See Also:
Configuration.wrapAttVals
-
getWrapAttVals
public boolean getWrapAttVals()
wrap-attributes- wrap within attribute values.- Returns:
trueif tidy will wrap within attribute values- See Also:
Configuration.wrapAttVals
-
setWrapScriptlets
public void setWrapScriptlets(boolean wrapScriptlets)
wrap-script-literals- wrap within JavaScript string literals.- Parameters:
wrapScriptlets-trueif tidy should wrap within JavaScript string literals- See Also:
Configuration.wrapScriptlets
-
getWrapScriptlets
public boolean getWrapScriptlets()
wrap-script-literals- wrap within JavaScript string literals.- Returns:
trueif tidy will wrap within JavaScript string literals- See Also:
Configuration.wrapScriptlets
-
setWrapSection
public void setWrapSection(boolean wrapSection)
wrap-sections- wrap within <![ ... ]> section tags- Parameters:
wrapSection-trueif tidy should wrap within <![ ... ]> section tags- See Also:
Configuration.wrapSection
-
getWrapSection
public boolean getWrapSection()
wrap-sections- wrap within <![ ... ]> section tags- Returns:
trueif tidy will wrap within <![ ... ]> section tags- See Also:
Configuration.wrapSection
-
setAltText
public void setAltText(java.lang.String altText)
alt-text- default text for alt attribute.- Parameters:
altText- default text for alt attribute- See Also:
Configuration.altText
-
getAltText
public java.lang.String getAltText()
alt-text- default text for alt attribute.- Returns:
- default text for alt attribute
- See Also:
Configuration.altText
-
setXmlPi
public void setXmlPi(boolean xmlPi)
add-xml-pi- add <?xml?> for XML docs.- Parameters:
xmlPi-trueif tidy should add <?xml?> for XML docs- See Also:
Configuration.xmlPi
-
getXmlPi
public boolean getXmlPi()
add-xml-pi- add <?xml?> for XML docs.- Returns:
trueif tidy will add <?xml?> for XML docs- See Also:
Configuration.xmlPi
-
setDropFontTags
public void setDropFontTags(boolean dropFontTags)
drop-font-tags- discard presentation tags.- Parameters:
dropFontTags-trueif tidy should discard presentation tags- See Also:
Configuration.dropFontTags
-
getDropFontTags
public boolean getDropFontTags()
drop-font-tags- discard presentation tags.- Returns:
trueif tidy will discard presentation tags- See Also:
Configuration.dropFontTags
-
setDropProprietaryAttributes
public void setDropProprietaryAttributes(boolean dropProprietaryAttributes)
drop-proprietary-attributes- discard proprietary attributes.- Parameters:
dropProprietaryAttributes-trueif tidy should discard proprietary attributes- See Also:
Configuration.dropProprietaryAttributes
-
getDropProprietaryAttributes
public boolean getDropProprietaryAttributes()
drop-proprietary-attributes- discard proprietary attributes.- Returns:
trueif tidy will discard proprietary attributes- See Also:
Configuration.dropProprietaryAttributes
-
setDropEmptyParas
public void setDropEmptyParas(boolean dropEmptyParas)
drop-empty-paras- discard empty p elements.- Parameters:
dropEmptyParas-trueif tidy should discard empty p elements- See Also:
Configuration.dropEmptyParas
-
getDropEmptyParas
public boolean getDropEmptyParas()
drop-empty-paras- discard empty p elements.- Returns:
trueif tidy will discard empty p elements- See Also:
Configuration.dropEmptyParas
-
setFixComments
public void setFixComments(boolean fixComments)
fix-bad-comments- fix comments with adjacent hyphens.- Parameters:
fixComments-trueif tidy should fix comments with adjacent hyphens- See Also:
Configuration.fixComments
-
getFixComments
public boolean getFixComments()
fix-bad-comments- fix comments with adjacent hyphens.- Returns:
trueif tidy will fix comments with adjacent hyphens- See Also:
Configuration.fixComments
-
setWrapAsp
public void setWrapAsp(boolean wrapAsp)
wrap-asp- wrap within ASP pseudo elements.- Parameters:
wrapAsp-trueif tidy should wrap within ASP pseudo elements- See Also:
Configuration.wrapAsp
-
getWrapAsp
public boolean getWrapAsp()
wrap-asp- wrap within ASP pseudo elements.- Returns:
trueif tidy will wrap within ASP pseudo elements- See Also:
Configuration.wrapAsp
-
setWrapJste
public void setWrapJste(boolean wrapJste)
wrap-jste- wrap within JSTE pseudo elements.- Parameters:
wrapJste-trueif tidy should wrap within JSTE pseudo elements- See Also:
Configuration.wrapJste
-
getWrapJste
public boolean getWrapJste()
wrap-jste- wrap within JSTE pseudo elements.- Returns:
trueif tidy will wrap within JSTE pseudo elements- See Also:
Configuration.wrapJste
-
setWrapPhp
public void setWrapPhp(boolean wrapPhp)
wrap-php- wrap within PHP pseudo elements.- Parameters:
wrapPhp-trueif tidy should wrap within PHP pseudo elements- See Also:
Configuration.wrapPhp
-
getWrapPhp
public boolean getWrapPhp()
wrap-php- wrap within PHP pseudo elements.- Returns:
trueif tidy will wrap within PHP pseudo elements- See Also:
Configuration.wrapPhp
-
setFixBackslash
public void setFixBackslash(boolean fixBackslash)
fix-backslash- fix URLs by replacing \ with /.- Parameters:
fixBackslash-trueif tidy should fix URLs by replacing \ with /- See Also:
Configuration.fixBackslash
-
getFixBackslash
public boolean getFixBackslash()
fix-backslash- fix URLs by replacing \ with /.- Returns:
trueif tidy will fix URLs by replacing \ with /- See Also:
Configuration.fixBackslash
-
setIndentAttributes
public void setIndentAttributes(boolean indentAttributes)
indent-attributes- newline+indent before each attribute.- Parameters:
indentAttributes-trueif tidy should output a newline+indent before each attribute- See Also:
Configuration.indentAttributes
-
getIndentAttributes
public boolean getIndentAttributes()
indent-attributes- newline+indent before each attribute.- Returns:
trueif tidy will output a newline+indent before each attribute- See Also:
Configuration.indentAttributes
-
setDocType
public void setDocType(java.lang.String doctype)
doctype- user specified doctype.- Parameters:
doctype-omit | auto | strict | loose | fpiwhere the fpi is a string similar to "-//ACME//DTD HTML 3.14159//EN" Note: for fpi include the double-quotes in the string.- See Also:
Configuration.docTypeStr,Configuration.docTypeMode
-
getDocType
public java.lang.String getDocType()
doctype- user specified doctype.- Returns:
omit | auto | strict | loose | fpiwhere the fpi is a string similar to "-//ACME//DTD HTML 3.14159//EN" Note: for fpi include the double-quotes in the string.- See Also:
Configuration.docTypeStr,Configuration.docTypeMode
-
setLogicalEmphasis
public void setLogicalEmphasis(boolean logicalEmphasis)
logical-emphasis- replace i by em and b by strong.- Parameters:
logicalEmphasis-trueif tidy should replace i by em and b by strong- See Also:
Configuration.logicalEmphasis
-
getLogicalEmphasis
public boolean getLogicalEmphasis()
logical-emphasis- replace i by em and b by strong.- Returns:
trueif tidy will replace i by em and b by strong- See Also:
Configuration.logicalEmphasis
-
setXmlPIs
public void setXmlPIs(boolean xmlPIs)
assume-xml-procinsThis 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.- Parameters:
xmlPIs-trueif tidy should expect a ?> at the end of processing instructions- See Also:
Configuration.xmlPIs
-
getXmlPIs
public boolean getXmlPIs()
assume-xml-procinsThis 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.- Returns:
trueif tidy will expect a ?> at the end of processing instructions- See Also:
Configuration.xmlPIs
-
setEncloseText
public void setEncloseText(boolean encloseText)
enclose-text- if true text at body is wrapped in <p>'s.- Parameters:
encloseText-trueif tidy should wrap text at body in <p>'s.- See Also:
Configuration.encloseBodyText
-
getEncloseText
public boolean getEncloseText()
enclose-text- if true text at body is wrapped in <p>'s.- Returns:
trueif tidy will wrap text at body in <p>'s.- See Also:
Configuration.encloseBodyText
-
setEncloseBlockText
public void setEncloseBlockText(boolean encloseBlockText)
enclose-block-text- if true text in blocks is wrapped in <p>'s.- Parameters:
encloseBlockText-trueif tidy should wrap text text in blocks in <p>'s.- See Also:
Configuration.encloseBlockText
-
getEncloseBlockText
public boolean getEncloseBlockText()
enclose-block-text- if true text in blocks is wrapped in <p>'s. returntrueif tidy should will text text in blocks in <p>'s.- See Also:
Configuration.encloseBlockText
-
setWord2000
public void setWord2000(boolean word2000)
word-2000- draconian cleaning for Word2000.- Parameters:
word2000-trueif tidy should clean word2000 documents- See Also:
Configuration.word2000
-
getWord2000
public boolean getWord2000()
word-2000- draconian cleaning for Word2000.- Returns:
trueif tidy will clean word2000 documents- See Also:
Configuration.word2000
-
setTidyMark
public void setTidyMark(boolean tidyMark)
tidy-mark- add meta element indicating tidied doc.- Parameters:
tidyMark-trueif tidy should add meta element indicating tidied doc- See Also:
Configuration.tidyMark
-
getTidyMark
public boolean getTidyMark()
tidy-mark- add meta element indicating tidied doc.- Returns:
trueif tidy will add meta element indicating tidied doc- See Also:
Configuration.tidyMark
-
setXmlSpace
public void setXmlSpace(boolean xmlSpace)
add-xml-space- if set to yes adds xml:space attr as needed.- Parameters:
xmlSpace-trueif tidy should add xml:space attr as needed- See Also:
Configuration.xmlSpace
-
getXmlSpace
public boolean getXmlSpace()
add-xml-space- if set to yes adds xml:space attr as needed.- Returns:
trueif tidy will add xml:space attr as needed- See Also:
Configuration.xmlSpace
-
setEmacs
public void setEmacs(boolean emacs)
gnu-emacs- if true format error output for GNU Emacs.- Parameters:
emacs-trueif tidy should format error output for GNU Emacs- See Also:
Configuration.emacs
-
getEmacs
public boolean getEmacs()
gnu-emacs- if true format error output for GNU Emacs.- Returns:
trueif tidy will format error output for GNU Emacs- See Also:
Configuration.emacs
-
setLiteralAttribs
public void setLiteralAttribs(boolean literalAttribs)
literal-attributes- if true attributes may use newlines.- Parameters:
literalAttribs-trueif attributes may use newlines- See Also:
Configuration.literalAttribs
-
getLiteralAttribs
public boolean getLiteralAttribs()
literal-attributes- if true attributes may use newlines.- Returns:
trueif attributes may use newlines- See Also:
Configuration.literalAttribs
-
setPrintBodyOnly
public void setPrintBodyOnly(boolean bodyOnly)
print-body-only- output BODY content only.- Parameters:
bodyOnly- true = print only the document body- See Also:
Configuration.bodyOnly
-
getPrintBodyOnly
public boolean getPrintBodyOnly()
print-body-only- output BODY content only.- Returns:
- true if tidy will print only the document body
-
setFixUri
public void setFixUri(boolean fixUri)
fix-uri- fix uri references applying URI encoding if necessary.- Parameters:
fixUri- true = fix uri references- See Also:
Configuration.fixUri
-
getFixUri
public boolean getFixUri()
fix-uri- output BODY content only.- Returns:
- true if tidy will fix uri references
-
setLowerLiterals
public void setLowerLiterals(boolean lowerLiterals)
lower-literals- folds known attribute values to lower case.- Parameters:
lowerLiterals- true = folds known attribute values to lower case- See Also:
Configuration.lowerLiterals
-
getLowerLiterals
public boolean getLowerLiterals()
lower-literals- folds known attribute values to lower case.- Returns:
- true if tidy will folds known attribute values to lower case
-
setHideComments
public void setHideComments(boolean hideComments)
hide-comments- hides all (real) comments in output.- Parameters:
hideComments- true = hides all comments in output- See Also:
Configuration.hideComments
-
getHideComments
public boolean getHideComments()
hide-comments- hides all (real) comments in output.- Returns:
- true if tidy will hide all comments in output
-
setIndentCdata
public void setIndentCdata(boolean indentCdata)
indent-cdata- indent CDATA sections.- Parameters:
indentCdata- true = indent CDATA sections- See Also:
Configuration.indentCdata
-
getIndentCdata
public boolean getIndentCdata()
indent-cdata- indent CDATA sections.- Returns:
- true if tidy will indent CDATA sections
-
setForceOutput
public void setForceOutput(boolean forceOutput)
force-output- output document even if errors were found.- Parameters:
forceOutput- true = output document even if errors were found- See Also:
Configuration.forceOutput
-
getForceOutput
public boolean getForceOutput()
force-output- output document even if errors were found.- Returns:
- true if tidy will output document even if errors were found
-
setShowErrors
public void setShowErrors(int showErrors)
show-errors- set the number of errors to put out.- Parameters:
showErrors- number of errors to put out- See Also:
Configuration.showErrors
-
getShowErrors
public int getShowErrors()
show-errors- number of errors to put out.- Returns:
- the number of errors tidy will put out
-
setAsciiChars
public void setAsciiChars(boolean asciiChars)
ascii-chars- convert quotes and dashes to nearest ASCII char.- Parameters:
asciiChars- true = convert quotes and dashes to nearest ASCII char- See Also:
Configuration.asciiChars
-
getAsciiChars
public boolean getAsciiChars()
ascii-chars- convert quotes and dashes to nearest ASCII char.- Returns:
- true if tidy will convert quotes and dashes to nearest ASCII char
-
setJoinClasses
public void setJoinClasses(boolean joinClasses)
join-classes- join multiple class attributes.- Parameters:
joinClasses- true = join multiple class attributes- See Also:
Configuration.joinClasses
-
getJoinClasses
public boolean getJoinClasses()
join-classes- join multiple class attributes.- Returns:
- true if tidy will join multiple class attributes
-
setJoinStyles
public void setJoinStyles(boolean joinStyles)
join-styles- join multiple style attributes.- Parameters:
joinStyles- true = join multiple style attributes- See Also:
Configuration.joinStyles
-
getJoinStyles
public boolean getJoinStyles()
join-styles- join multiple style attributes.- Returns:
- true if tidy will join multiple style attributes
-
setTrimEmptyElements
public void setTrimEmptyElements(boolean trimEmpty)
trim-empty-elements- trim empty elements.- Parameters:
trim- -empty-elements true = trim empty elements- See Also:
Configuration.trimEmpty
-
getTrimEmptyElements
public boolean getTrimEmptyElements()
trim-empty-elements- trim empty elements.- Returns:
- true if tidy will trim empty elements
-
setReplaceColor
public void setReplaceColor(boolean replaceColor)
replace-color- replace hex color attribute values with names.- Parameters:
replaceColor- true = replace hex color attribute values with names- See Also:
Configuration.replaceColor
-
getReplaceColor
public boolean getReplaceColor()
replace-color- replace hex color attribute values with names.- Returns:
- true if tidy will replace hex color attribute values with names
-
setEscapeCdata
public void setEscapeCdata(boolean escapeCdata)
escape-cdata- replace CDATA sections with escaped text.- Parameters:
escapeCdata- true = replace CDATA sections with escaped text- See Also:
Configuration.escapeCdata
-
getEscapeCdata
public boolean getEscapeCdata()
escape-cdata-replace CDATA sections with escaped text.- Returns:
- true if tidy will replace CDATA sections with escaped text
-
setRepeatedAttributes
public void setRepeatedAttributes(int repeatedAttributes)
repeated-attributes- keep first or last duplicate attribute.- Parameters:
repeatedAttributes-Configuration.KEEP_FIRST | Configuration.KEEP_LAST- See Also:
Configuration.duplicateAttrs
-
getRepeatedAttributes
public int getRepeatedAttributes()
repeated-attributes- keep first or last duplicate attribute.- Returns:
Configuration.KEEP_FIRST | Configuration.KEEP_LAST
-
setKeepFileTimes
public void setKeepFileTimes(boolean keepFileTimes)
keep-time- if true last modified time is preserved.- Parameters:
keepFileTimes-trueif tidy should preserved last modified time in input file.- See Also:
Configuration.keepFileTimes
-
getKeepFileTimes
public boolean getKeepFileTimes()
keep-time- if true last modified time is preserved.- Returns:
trueif tidy will preserved last modified time in input file.- See Also:
Configuration.keepFileTimes
-
setRawOut
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.- Parameters:
rawOut- avoid mapping values > 127 to entities- See Also:
Configuration.rawOut
-
getRawOut
public boolean getRawOut()
output-raw- avoid mapping values > 127 to entities.- Returns:
trueif tidy will not map values > 127 to entities- See Also:
Configuration.rawOut
-
setInputEncoding
public void setInputEncoding(java.lang.String encoding)
input-encodingthe character encoding used for input.- Parameters:
encoding- a valid java encoding name
-
getInputEncoding
public java.lang.String getInputEncoding()
input-encodingthe character encoding used for input.- Returns:
- the java name of the encoding currently used for input
-
setOutputEncoding
public void setOutputEncoding(java.lang.String encoding)
output-encodingthe character encoding used for output.- Parameters:
encoding- a valid java encoding name
-
getOutputEncoding
public java.lang.String getOutputEncoding()
output-encodingthe character encoding used for output.- Returns:
- the java name of the encoding currently used for output
-
-