當前位置: 首頁>>代碼示例>>Java>>正文


Java Tidy.setQuiet方法代碼示例

本文整理匯總了Java中org.w3c.tidy.Tidy.setQuiet方法的典型用法代碼示例。如果您正苦於以下問題:Java Tidy.setQuiet方法的具體用法?Java Tidy.setQuiet怎麽用?Java Tidy.setQuiet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.w3c.tidy.Tidy的用法示例。


在下文中一共展示了Tidy.setQuiet方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cleanNfo

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * Try to clean the NFO(XML) content with JTidy.
 * 
 * @param sourceNfoContent
 *          the XML content to be cleaned
 * @return the cleaned XML content (or the source, if any Exceptions occur)
 */
public static String cleanNfo(String sourceNfoContent) {
  try {
    Tidy tidy = new Tidy();
    tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setWraplen(Integer.MAX_VALUE);
    tidy.setXmlOut(true);
    tidy.setSmartIndent(true);
    tidy.setXmlTags(true);
    tidy.setMakeClean(true);
    tidy.setForceOutput(true);
    tidy.setQuiet(true);
    tidy.setShowWarnings(false);
    StringReader in = new StringReader(sourceNfoContent);
    StringWriter out = new StringWriter();
    tidy.parse(in, out);

    return out.toString();
  }
  catch (Exception e) {
  }
  return sourceNfoContent;
}
 
開發者ID:tinyMediaManager,項目名稱:tinyMediaManager,代碼行數:31,代碼來源:ParserUtils.java

示例2: 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));
}
 
開發者ID:gnosygnu,項目名稱:xowa_android,代碼行數:26,代碼來源:Xoh_tidy_wkr_jtidy.java

示例3: getHtmlDocument

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
private Document getHtmlDocument(String htmlContent) {
	StringBuilder sb = new StringBuilder();
	sb.append("<html>");
	sb.append("<head><style language='text/css'>");
	sb.append("@page{ margin: 0; }");
	sb.append("body{ margin:0;}");
	sb.append("</style></head>");
	sb.append("<body>");
	sb.append(htmlContent);
	sb.append("</body>");
	sb.append("</html>");
	
	Tidy tidy = new Tidy();
	tidy.setXHTML(true);
	tidy.setQuiet(true);
	tidy.setShowWarnings(false);
	
	return tidy.parseDOM(new ByteArrayInputStream(sb.toString().getBytes()), null);
}
 
開發者ID:TIBCOSoftware,項目名稱:jasperreports,代碼行數:20,代碼來源:FlyingSaucerHtmlPrintElement.java

示例4: getParser

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * Returns <code>tidy</code> as HTML parser.
 *
 * @return a <code>tidy</code> HTML parser
 */
public static Tidy getParser() {
    log.debug("Start : getParser1");
    Tidy tidy = new Tidy();
    tidy.setInputEncoding("UTF8");
    tidy.setOutputEncoding("UTF8");
    tidy.setQuiet(true);
    tidy.setShowWarnings(false);

    if (log.isDebugEnabled()) {
        log.debug("getParser1 : tidy parser created - " + tidy);
    }

    log.debug("End : getParser1");

    return tidy;
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:22,代碼來源:HtmlParsingUtils.java

示例5: getXHTML

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public static String getXHTML(String html){
	
	Tidy tidy = new Tidy();

	tidy.setXHTML(true);
	tidy.setMakeClean(true);
	tidy.setShowWarnings(false);
	tidy.setShowErrors(0);
	tidy.setQuiet(true);
	tidy.setPrintBodyOnly(true);
	tidy.setOutputEncoding("ISO-8859-1");
	
	StringWriter stringWriter = new StringWriter();
	
	tidy.parse(new StringReader(html), stringWriter);
	
	return stringWriter.toString();
}
 
開發者ID:Sundsvallskommun,項目名稱:Open-ePlatform,代碼行數:19,代碼來源:JTidyUtils.java

示例6: getParser

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
private static Tidy getParser( URL url ) {
    Tidy tidy = new Tidy();
    tidy.setCharEncoding( org.w3c.tidy.Configuration.UTF8 );
    tidy.setQuiet( true );
    tidy.setShowWarnings( HTMLParserFactory.isParserWarningsEnabled() );
    if (!HTMLParserFactory.getHTMLParserListeners().isEmpty()) {
        tidy.setErrout( new JTidyPrintWriter( url ) );
    }
    return tidy;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:11,代碼來源:JTidyHTMLParser.java

示例7: tidyHtml

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
protected Document tidyHtml(InputStream in) {
	Tidy tidy = new Tidy();
	tidy.setQuiet(true);
	tidy.setShowWarnings(false);

	Document dom = tidy.parseDOM(in, null);
	return dom;
}
 
開發者ID:skarna1,項目名稱:javaportfolio,代碼行數:9,代碼來源:HTTPDocumentFetcher.java

示例8: validate

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * Validate the HTML content received after executed partnership operation. The content
 * is passed as a input stream <code>ins</code>.
 * <br/><br/>
 * This operation is quite expensive because it first transform the whole HTML content
 * received to a well-formed XHTML before parsing by the SAX Parser.  
 * 
 * @param ins The HTML content to validate the result of partnership operation  
 * @throws SAXException 
 * 			<ol>
 * 				<li>When unable to down-load the HTML DTD from the web. Check your Internet connectivity</li>
 * 				<li>When IO related problems occur</li>
 * 			</ol>
 * @throws ParserConfigurationException
 * 			When SAX parser mis-configures. 
 */
public void validate(InputStream ins) throws SAXException, ParserConfigurationException
{ 		
	if (ins == null)
		throw new NullPointerException("Missing 'input stream' for validation");
	try{
		// TODO: SLOW, It requires two full-scan transformation to find the result of the partnership operation. 			
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		/* Transforms to well-formed XHTML */	
		Tidy t = new Tidy();
		t.setXHTML(true); t.setQuiet(true); t.setShowWarnings(false);
		t.parse(ins, baos);
		
		// For debug purpose
		// System.out.println(hk.hku.cecid.piazza.commons.io.IOHandler.readString(ins, null));
		// System.out.println("Test: " + new String(baos.toByteArray(), "UTF-8"));			 
		
		/* Pipe to another input stream */
		ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
		// Create a custom SAX handler for parsing the partnership op result from the HTML.
		PageletContentVerifer verifer = new PageletContentVerifer();
		// Create SAX parser for parsing the HTML coming back after executing partnership operation.
		spf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
		SAXParser parser = spf.newSAXParser();
		parser.parse(bais, verifer);				
					
		boolean result = verifer.getIsVerifiedWithNoError();
		if (!result) throw new SAXException("Fail to execute partnership operation as : " + verifer.getVerifiedMessage());
	}
	catch(ConnectException cex){			
		cex.printStackTrace();
		throw new SAXException("Seems unable to download correct DTD from the web, behind proxy/firewall?", cex);			
	}				
	catch(IOException ioex){
		throw new SAXException("IO Error during SAX parsing.", ioex);
	}
}
 
開發者ID:cecid,項目名稱:hermes,代碼行數:53,代碼來源:PartnershipOpVerifer.java

示例9: formatXml

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public static String formatXml(@NotNull String xml) throws TransformerException {
    StringReader stringReader = new StringReader(xml);
    Tidy tidy = new Tidy();
    tidy.setXmlOut(true);
    tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setTidyMark(false);
    tidy.setForceOutput(true);
    tidy.setSmartIndent(true);
    tidy.setShowWarnings(false);
    tidy.setQuiet(true);
    StringWriter stringWriter = new StringWriter();
    tidy.parse(stringReader, stringWriter);
    return stringWriter.toString();
}
 
開發者ID:FingerArt,項目名稱:ApiDebugger,代碼行數:16,代碼來源:StringUtils.java

示例10: formatHtml

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public static String formatHtml(String html) {
    StringReader stringReader = new StringReader(html);
    Tidy tidy = new Tidy();
    tidy.setXHTML(true);
    tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setTidyMark(false);
    tidy.setSmartIndent(true);
    tidy.setForceOutput(true);
    tidy.setShowWarnings(false);
    tidy.setQuiet(true);
    StringWriter stringWriter = new StringWriter();
    tidy.parse(stringReader, stringWriter);
    return stringWriter.toString();
}
 
開發者ID:FingerArt,項目名稱:ApiDebugger,代碼行數:16,代碼來源:StringUtils.java

示例11: makeTidyParser

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * Create a Tidy parser with the specified settings.
 *
 * @param quiet - set the Tidy quiet flag?
 * @param showWarnings - show Tidy warnings?
 * @param isXml - treat the content as XML?
 * @param stringWriter - if non-null, use this for Tidy errorOutput
 * @return the Tidy parser
 */
public static Tidy makeTidyParser(boolean quiet, boolean showWarnings, boolean isXml, StringWriter stringWriter) {
    Tidy tidy = new Tidy();
    tidy.setInputEncoding("UTF8");
    tidy.setOutputEncoding("UTF8");
    tidy.setQuiet(quiet);
    tidy.setShowWarnings(showWarnings);
    tidy.setMakeClean(true);
    tidy.setXmlTags(isXml);
    if (stringWriter != null) {
        tidy.setErrout(new PrintWriter(stringWriter));
    }
    return tidy;
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:23,代碼來源:XPathUtil.java

示例12: getTidyParser

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * Returns <code>tidy</code> as HTML parser.
 *
 * @return a <code>tidy</code> HTML parser
 */
private static Tidy getTidyParser(String encoding) {
    log.debug("Start : getParser");
    Tidy tidy = new Tidy();
    tidy.setInputEncoding(encoding);
    tidy.setOutputEncoding("UTF8");
    tidy.setQuiet(true);
    tidy.setShowWarnings(false);
    if (log.isDebugEnabled()) {
        log.debug("getParser : tidy parser created - " + tidy);
    }
    log.debug("End   : getParser");
    return tidy;
}
 
開發者ID:johrstrom,項目名稱:cloud-meter,代碼行數:19,代碼來源:JTidyHTMLParser.java

示例13: 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();


    }
 
開發者ID:triguero,項目名稱:Keel3.0,代碼行數:34,代碼來源:HtmlToKeel.java

示例14: 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();


}
 
開發者ID:SCI2SUGR,項目名稱:KEEL,代碼行數:41,代碼來源:HtmlToKeel.java

示例15: URIContext

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * Constructor.
 *
 * @param scanDir Scan directory.
 * @param sockFactory Socket factory.
 */
public URIContext(URL scanDir, SSLSocketFactory sockFactory) {
    this.scanDir = scanDir;
    this.sockFactory = sockFactory;

    tidy = new Tidy();

    tidy.setQuiet(true);
    tidy.setOnlyErrors(true);
    tidy.setShowWarnings(false);
    tidy.setInputEncoding("UTF8");
    tidy.setOutputEncoding("UTF8");
}
 
開發者ID:apache,項目名稱:ignite,代碼行數:19,代碼來源:UriDeploymentHttpScanner.java


注:本文中的org.w3c.tidy.Tidy.setQuiet方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。