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


Java Tidy.setWraplen方法代碼示例

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


在下文中一共展示了Tidy.setWraplen方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: JTidyBookProcessor

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public JTidyBookProcessor()
    {
        tidy = new Tidy();
//        tidy.setConfigurationFromFile(JTidyBookProcessor.class.getResource("/jtidy.properties").getFile());
        tidy.setSpaces(2);
        tidy.setIndentContent(true);
        tidy.setSmartIndent(true);
        tidy.setXHTML(true);
        tidy.setQuoteMarks(false);
        tidy.setQuoteAmpersand(true);
        tidy.setDropEmptyParas(false);
        tidy.setTidyMark(false);
        tidy.setJoinClasses(true);
        tidy.setJoinStyles(true);
        tidy.setWraplen(0);
        tidy.setDropProprietaryAttributes(true);
        tidy.setEscapeCdata(true);
        Properties props = new Properties();
        props.put("new-blocklevel-tags", "svg image  altGlyph altGlyphDef altGlyphItem animate animateColor animateMotion animateTransform circle clipPath color-profile cursor defs desc ellipse feBlend feColorMatrix feComponentTransfer feComposite feConvolveMatrix feDiffuseLighting feDisplacementMap feDistantLight feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur feImage feMerge feMergeNode feMorphology feOffset fePointLight feSpecularLighting feSpotLight feTile feTurbulence filter font font-face font-face-format font-face-name font-face-src font-face-uri foreignObject g glyph glyphRef hkern image line linearGradient marker mask metadata missing-glyph mpath path pattern polygon polyline radialGradient rect script set stop style svg switch symbol text textPath title tref tspan use view vkern");
        tidy.getConfiguration().addProps(props);
    }
 
開發者ID:finanzer,項目名稱:epubfx,代碼行數:22,代碼來源:JTidyBookProcessor.java

示例4: cleanupHtml

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
private String cleanupHtml(String story) {
    Tidy tidy = new Tidy();
    tidy.setInputEncoding(ENCODING);
    tidy.setOutputEncoding(ENCODING);
    tidy.setPrintBodyOnly(true);
    tidy.setXmlOut(true);
    tidy.setSmartIndent(false);
    tidy.setBreakBeforeBR(false);
    tidy.setMakeBare(true);
    tidy.setMakeClean(true);
    tidy.setNumEntities(true);
    tidy.setWraplen(0);

    StringWriter writer = new StringWriter();
    StringReader reader = new StringReader(story);
    tidy.parse(reader, writer);
    return writer.toString();
}
 
開發者ID:getconverge,項目名稱:converge-1.x,代碼行數:19,代碼來源:NewsItemPlacementToAtomConverter.java

示例5: cleanXMLData

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public static String cleanXMLData(String data) throws UnsupportedEncodingException {
   // data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+data;

	Tidy tidy = new Tidy();
    tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setWraplen(Integer.MAX_VALUE);
  //  tidy.setPrintBodyOnly(true);
    tidy.setXmlOut(true);
    tidy.setXmlTags(true);
    tidy.setSmartIndent(true);
    tidy.setMakeClean(true);
    tidy.setForceOutput(true);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(data.getBytes("UTF-8"));
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    tidy.parseDOM(inputStream, outputStream);
    return outputStream.toString("UTF-8");
}
 
開發者ID:karutaproject,項目名稱:karuta-backend,代碼行數:19,代碼來源:DomUtils.java

示例6: htmlOutputStreamViaTidy

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * To Output html Stream via Tidy.
 * 
 * @param pathOfHOCRFile String
 * @param outputFilePath String
 * @throws IOException
 */
public static void htmlOutputStreamViaTidy(final String pathOfHOCRFile, final String outputFilePath) throws IOException {

	Tidy tidy = new Tidy();
	tidy.setXHTML(true);
	tidy.setDocType(DOC_TYPE_OMIT);
	tidy.setInputEncoding(UTF_ENCODING);
	tidy.setOutputEncoding(UTF_ENCODING);
	tidy.setForceOutput(true);
	tidy.setWraplen(0);
	FileInputStream inputStream = null;

	OutputStream fout = null;
	OutputStream bout = null;
	OutputStreamWriter out = null;
	try {
		/*
		 * Fix for UTF-8 encoding to support special characters in turkish and czech language. UTF-8 encoding supports major
		 * characters in all the languages
		 */
		fout = new FileOutputStream(outputFilePath);
		bout = new BufferedOutputStream(fout);
		out = new OutputStreamWriter(bout, UTF_ENCODING);

		inputStream = new FileInputStream(pathOfHOCRFile);
		tidy.parse(inputStream, out);
	} finally {
		IOUtils.closeQuietly(inputStream);
		IOUtils.closeQuietly(out);
		IOUtils.closeQuietly(bout);
		IOUtils.closeQuietly(fout);
	}
}
 
開發者ID:kuzavas,項目名稱:ephesoft,代碼行數:40,代碼來源:XMLUtil.java

示例7: beautyHTML

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
private String beautyHTML(String html) throws UnsupportedEncodingException {
	Tidy tidy = new Tidy();
	tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setWraplen(Integer.MAX_VALUE);
    tidy.setXmlOut(true);
    tidy.setXmlTags(true);
    tidy.setSmartIndent(true);
    ByteArrayInputStream inputStream = new ByteArrayInputStream(html.getBytes("UTF-8"));
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    Document doc = tidy.parseDOM(inputStream, null);
    tidy.pprint(doc, outputStream);
    return outputStream.toString("UTF-8");
}
 
開發者ID:sinnlabs,項目名稱:dbvim,代碼行數:15,代碼來源:ModelTree.java

示例8: 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

示例9: 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

示例10: getTidyHtml

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
/**
 * Clean HTML document and return XML as byte array
 * 
 * @param resourceMap map of resources
 * @param resID unique ID of resource
 * @return clean XHTML document as {@code byte[]}
 * @throws IOException
 */
private byte[] getTidyHtml(PandaSettings pandaSettings, String resID) throws IOException {
    byte[] doc = null;
    // Get local path to file, if null the URL field will be used to
    // retrieve resource
    ResourceInfo resInfo = pandaSettings.getResourceMap().getMap().get(resID);
    String filePath = resInfo.getFilePath();

    // properties for HTML cleaning
    Tidy tidy = new Tidy();
    // no output of warnings/errors
    tidy.setQuiet(true);
    tidy.setShowWarnings(false);

    tidy.setHideEndTags(true);
    tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setWraplen(Integer.MAX_VALUE);
    // set output to XML
    tidy.setXmlOut(true);

    // get HTML document, parse HTML
    InputStream htmlDoc = null;
    if (filePath != null) {
        htmlDoc = new FileInputStream(filePath);
    } else {
        // Get online resource
        URL resURL = pandaSettings.getResourceMap().getMap().get(resID).getURL();
        htmlDoc = getOnlineResource(resURL);
    }

    ByteArrayOutputStream out = new ByteArrayOutputStream();
    tidy.parse(htmlDoc, out);
    doc = out.toByteArray();

    return doc;
}
 
開發者ID:chsatgithub,項目名稱:PANDA-DEEPLINKING,代碼行數:45,代碼來源:DataHtmlResource.java

示例11: createTidy

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public static Tidy createTidy() {
    Tidy tidy = new Tidy();
    tidy.setQuiet(true);
    // tidy.setMakeClean(true);
    // tidy.setIndentContent(true);
    tidy.setSmartIndent(true);
    // tidy.setXmlOut(true);
    tidy.setXHTML(true);
    tidy.setWraplen(Integer.MAX_VALUE);

    // tidy.setDocType("omit");
    // tidy.setNumEntities(true);
    return tidy;
}
 
開發者ID:cobbzilla,項目名稱:cobbzilla-utils,代碼行數:15,代碼來源:TidyUtil.java

示例12: Beautifier

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public Beautifier() {
    tidy = new Tidy();
    
    tidy.setWraplen(0);
    //tidy.setDropEmptyParas(false);
    tidy.setDropFontTags(false);
    tidy.setDropProprietaryAttributes(false);
    tidy.setIndentContent(true);

}
 
開發者ID:dobin,項目名稱:BurpSentinel,代碼行數:11,代碼來源:Beautifier.java

示例13: 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;
	}
}
 
開發者ID:OpenBD,項目名稱:openbd-core,代碼行數:70,代碼來源:HtmlCleanUp.java

示例14: convertToXMLOLD

import org.w3c.tidy.Tidy; //導入方法依賴的package包/類
public static String convertToXMLOLD(String xml){
	//======================================
//	String newXML = xml;
//	String xml1 = "";
//	String xml2 = "";
//	String html = "";
//	if (xml.indexOf("<text>")>-1) {
//	xml1 = xml.substring(0,xml.indexOf("<text>")+6);
//	xml2 = xml.substring(xml.indexOf("</text>"));
//	html = xml.substring(xml.indexOf("<text>")+6,xml.indexOf("</text>"));
//	}
//	if (xml.indexOf("<comment>")>-1) {
//	xml1 = xml.substring(0,xml.indexOf("<comment>")+9);
//	xml2 = xml.substring(xml.indexOf("</comment>"));
//	html = xml.substring(xml.indexOf("<comment>")+9,xml.indexOf("</comment>"));
//	}
//	if (xml.indexOf("<description>")>-1) {
//	xml1 = xml.substring(0,xml.indexOf("<description>")+13);
//	xml2 = xml.substring(xml.indexOf("</description>"));
//	html = xml.substring(xml.indexOf("<description>")+13,xml.indexOf("</description>"));
//	}
//	if (html.length()>0) {  // xml is html
//	html = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'><head><title></title></head><body>" +html+"</body>";
	StringReader in = new StringReader(xml);
	StringWriter out = new StringWriter();
	Tidy tidy = new Tidy();
	tidy.setInputEncoding("UTF-8");
    tidy.setOutputEncoding("UTF-8");
    tidy.setWraplen(Integer.MAX_VALUE);
    tidy.setPrintBodyOnly(true);
	tidy.setMakeClean(true);
//	tidy.setForceOutput(true);
    tidy.setSmartIndent(true);
    tidy.setXmlTags(true);
	tidy.setXmlOut(true);

//	tidy.setWraplen(0);
	tidy.parseDOM(in, out);
	String newXML = out.toString();
//	newXML = xml1+newHTML.substring(newHTML.indexOf("<body>")+6,newHTML.indexOf("</body>"))+xml2;
//	} else {
//	newXML =xml;
//	}
//	return newXML;
	return newXML;
	}
 
開發者ID:karutaproject,項目名稱:karuta-backend,代碼行數:47,代碼來源:DomUtils.java


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