本文整理匯總了Java中org.w3c.tidy.Tidy.setFixBackslash方法的典型用法代碼示例。如果您正苦於以下問題:Java Tidy.setFixBackslash方法的具體用法?Java Tidy.setFixBackslash怎麽用?Java Tidy.setFixBackslash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.w3c.tidy.Tidy
的用法示例。
在下文中一共展示了Tidy.setFixBackslash方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: tidy_init
import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public void tidy_init() {
long bgn = System_.Ticks();
wtr = new ByteArrayOutputStream();
System.setProperty("line.separator", "\n");
tidy = new Tidy(); // obtain a new Tidy instance
tidy.setInputEncoding("utf-8"); // -utf8
tidy.setOutputEncoding("utf-8"); // -utf8
tidy.setDocType("\"\""); // --doctype \"\"; set to empty else some wikis will show paragraph text with little vertical gap; PAGE:tr.b:
tidy.setForceOutput(true); // --force-output y
tidy.setQuiet(true); // --quiet y
tidy.setTidyMark(false); // --tidy-mark n
tidy.setWraplen(0); // --wrap 0
tidy.setIndentContent(true); // --indent y; NOTE: true indents all content in edit box
tidy.setQuoteNbsp(true); // --quote-nbsp y
tidy.setLiteralAttribs(true); // --literal-attributes y
tidy.setWrapAttVals(false); // --wrap-attributes n
tidy.setFixUri(false); // --fix-url n
tidy.setFixBackslash(false); // --fix-backslash n
tidy.setEncloseBlockText(true); // --enclose-block-text y; NOTE: true creates extra <p>; very noticeable in sidebar
tidy.setNumEntities(false); // NOTE: true will convert all UTF-8 chars to &#val; which ruins readability
tidy.setTrimEmptyElements(true); // NOTE: tidy always trims (not even an option)
tidy.setShowWarnings(false); // NOTE: otherwise warnings printed to output window
tidy.setShowErrors(0); // NOTE: otherwise errors printed to output window; EX: Error: <time> is not recognized!
app.Usr_dlg().Log_many("", "", "jtidy.init; elapsed=~{0}", System_.Ticks__elapsed_in_frac(bgn));
}
示例2: ConverterXhtml
import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public void ConverterXhtml(String fileHtml, String fileXhtmlAux) throws Exception {
Tidy tidy = new Tidy();
FileInputStream in = new FileInputStream(fileHtml);
FileOutputStream out = new FileOutputStream(fileXhtmlAux);
tidy.setTidyMark(false);
tidy.setDocType("omit");
tidy.setAltText("");
tidy.setFixBackslash(true);
tidy.setFixComments(true);
tidy.setXmlPi(true);
tidy.setQuoteAmpersand(true);
tidy.setQuoteNbsp(true);
tidy.setNumEntities(true);
tidy.setXmlOut(true);
tidy.setWraplen(999);
tidy.setWriteback(true);
tidy.setQuoteMarks(true);
tidy.setLogicalEmphasis(true);
tidy.setEncloseText(true);
tidy.setHideEndTags(true);
tidy.setShowWarnings(false);
tidy.setQuiet(true);
tidy.setXHTML(true);
tidy.parse(in, out);
in.close();
out.close();
}
示例3: ConverterXhtml
import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
* Method used to transform the data from the html file given as parameter to
* xhtml format file which will be stored in the second file given.
* @param fileHtml input html file path.
* @param fileXhtmlAux output xhtml file path.
* @throws Exception if the files can not be read or written.
*/
public void ConverterXhtml(String fileHtml, String fileXhtmlAux) throws Exception {
Tidy tidy = new Tidy();
FileInputStream in = new FileInputStream(fileHtml);
FileOutputStream out = new FileOutputStream(fileXhtmlAux);
tidy.setTidyMark(false);
tidy.setDocType("omit");
tidy.setAltText("");
tidy.setFixBackslash(true);
tidy.setFixComments(true);
tidy.setXmlPi(true);
tidy.setQuoteAmpersand(true);
tidy.setQuoteNbsp(true);
tidy.setNumEntities(true);
tidy.setXmlOut(true);
tidy.setWraplen(999);
tidy.setWriteback(true);
tidy.setQuoteMarks(true);
tidy.setLogicalEmphasis(true);
tidy.setEncloseText(true);
tidy.setHideEndTags(true);
tidy.setShowWarnings(false);
tidy.setQuiet(true);
tidy.setXHTML(true);
tidy.parse(in, out);
in.close();
out.close();
}
示例4: execute
import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public cfData execute(cfSession _session, cfArgStructData argStruct ) throws cfmRunTimeException {
try{
Tidy tidy = new Tidy();
final StringBuilder errors = new StringBuilder(32);
tidy.setMessageListener( new TidyMessageListener(){
public void messageReceived(TidyMessage mess) {
errors.append( "Line: " + mess.getLine() + "." + mess.getColumn() + "; " + mess.getMessage() + "\r\n" );
}
});
tidy.setSmartIndent( false );
tidy.setSpaces( 2 );
tidy.setTabsize( 2 );
tidy.setWraplen( 0 );
tidy.setLogicalEmphasis( true );
tidy.setMakeClean( true );
tidy.setQuiet( true );
tidy.setDropEmptyParas( true );
tidy.setXHTML( true );
tidy.setXmlSpace( true );
tidy.setTrimEmptyElements( true );
tidy.setBreakBeforeBR( false );
tidy.setUpperCaseTags( false );
tidy.setUpperCaseAttrs( false );
tidy.setWord2000( true );
tidy.setFixUri(false);
tidy.setFixBackslash( false );
tidy.setIndentAttributes( false );
tidy.setShowWarnings( false );
tidy.setShowErrors( 1 );
tidy.setOnlyErrors( false );
tidy.setPrintBodyOnly( false );
tidy.setJoinClasses( true );
tidy.setJoinStyles( true );
String inHtml = getNamedStringParam(argStruct,"string","");
StringReader reader = new StringReader( inHtml );
StringWriter writer = new StringWriter();
tidy.parse( reader, writer );
if ( errors.length() != 0 ){
throwException( _session, errors.toString() );
return null;
}else{
String outHtml = writer.toString();
int c1 = outHtml.indexOf("<body>");
if ( c1 >= 0 ){
outHtml = outHtml.substring( c1 + 6 );
c1 = outHtml.lastIndexOf("</body>");
if ( c1 >= 0 ){
outHtml = outHtml.substring( 0, c1 );
}
}
return new cfStringData( outHtml );
}
}catch( Exception e ){
throwException( _session, e.getMessage() );
return null;
}
}