⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tidy.java

📁 windows 代码
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
/*
 * @(#)Tidy.java   1.11 2000/08/16
 *
 */

/*
  HTML parser and pretty printer

  Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
  Institute of Technology, Institut National de Recherche en
  Informatique et en Automatique, Keio University). All Rights
  Reserved.

  Contributing Author(s):

     Dave Raggett <dsr@w3.org>
     Andy Quick <ac.quick@sympatico.ca> (translation to Java)

  The contributing author(s) would like to thank all those who
  helped with testing, bug fixes, and patience.  This wouldn't
  have been possible without all of you.

  COPYRIGHT NOTICE:
 
  This software and documentation is provided "as is," and
  the copyright holders and contributing author(s) make no
  representations or warranties, express or implied, including
  but not limited to, warranties of merchantability or fitness
  for any particular purpose or that the use of the software or
  documentation will not infringe any third party patents,
  copyrights, trademarks or other rights. 

  The copyright holders and contributing author(s) will not be
  liable for any direct, indirect, special or consequential damages
  arising out of any use of the software or documentation, even if
  advised of the possibility of such damage.

  Permission is hereby granted to use, copy, modify, and distribute
  this source code, or portions hereof, documentation and executables,
  for any purpose, without fee, subject to the following restrictions:

  1. The origin of this source code must not be misrepresented.
  2. Altered versions must be plainly marked as such and must
     not be misrepresented as being the original source.
  3. This Copyright notice may not be removed or altered from any
     source or altered source distribution.
 
  The copyright holders and contributing author(s) specifically
  permit, without fee, and encourage the use of this source code
  as a component for supporting the Hypertext Markup Language in
  commercial products. If you use this source code in a product,
  acknowledgment is not required but would be appreciated.
*/

package org.w3c.tidy;

import java.io.PrintWriter;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.util.Properties;

import java.io.IOException;
import java.io.FileNotFoundException;

/**
 *
 * <p>HTML parser and pretty printer</p>
 *
 * <p>
 * (c) 1998-2000 (W3C) MIT, INRIA, Keio University
 * See Tidy.java for the copyright notice.
 * Derived from <a href="http://www.w3.org/People/Raggett/tidy">
 * HTML Tidy Release 4 Aug 2000</a>
 * </p>
 *
 * <p>
 * Copyright (c) 1998-2000 World Wide Web Consortium (Massachusetts
 * Institute of Technology, Institut National de Recherche en
 * Informatique et en Automatique, Keio University). All Rights
 * Reserved.
 * </p>
 *
 * <p>
 * Contributing Author(s):<br>
 *    <a href="mailto:dsr@w3.org">Dave Raggett</a><br>
 *    <a href="mailto:ac.quick@sympatico.ca">Andy Quick</a> (translation to Java)
 * </p>
 *
 * <p>
 * The contributing author(s) would like to thank all those who
 * helped with testing, bug fixes, and patience.  This wouldn't
 * have been possible without all of you.
 * </p>
 *
 * <p>
 * COPYRIGHT NOTICE:<br>
 * 
 * This software and documentation is provided "as is," and
 * the copyright holders and contributing author(s) make no
 * representations or warranties, express or implied, including
 * but not limited to, warranties of merchantability or fitness
 * for any particular purpose or that the use of the software or
 * documentation will not infringe any third party patents,
 * copyrights, trademarks or other rights. 
 * </p>
 *
 * <p>
 * The copyright holders and contributing author(s) will not be
 * liable for any direct, indirect, special or consequential damages
 * arising out of any use of the software or documentation, even if
 * advised of the possibility of such damage.
 * </p>
 *
 * <p>
 * Permission is hereby granted to use, copy, modify, and distribute
 * this source code, or portions hereof, documentation and executables,
 * for any purpose, without fee, subject to the following restrictions:
 * </p>
 *
 * <p>
 * <ol>
 * <li>The origin of this source code must not be misrepresented.</li>
 * <li>Altered versions must be plainly marked as such and must
 * not be misrepresented as being the original source.</li>
 * <li>This Copyright notice may not be removed or altered from any
 * source or altered source distribution.</li>
 * </ol>
 * </p>
 *
 * <p>
 * The copyright holders and contributing author(s) specifically
 * permit, without fee, and encourage the use of this source code
 * as a component for supporting the Hypertext Markup Language in
 * commercial products. If you use this source code in a product,
 * acknowledgment is not required but would be appreciated.
 * </p>
 *
 * @author  Dave Raggett <dsr@w3.org>
 * @author  Andy Quick <ac.quick@sympatico.ca> (translation to Java)
 * @version 1.0, 1999/05/22
 * @version 1.0.1, 1999/05/29
 * @version 1.1, 1999/06/18 Java Bean
 * @version 1.2, 1999/07/10 Tidy Release 7 Jul 1999
 * @version 1.3, 1999/07/30 Tidy Release 26 Jul 1999
 * @version 1.4, 1999/09/04 DOM support
 * @version 1.5, 1999/10/23 Tidy Release 27 Sep 1999
 * @version 1.6, 1999/11/01 Tidy Release 22 Oct 1999
 * @version 1.7, 1999/12/06 Tidy Release 30 Nov 1999
 * @version 1.8, 2000/01/22 Tidy Release 13 Jan 2000
 * @version 1.9, 2000/06/03 Tidy Release 30 Apr 2000
 * @version 1.10, 2000/07/22 Tidy Release 8 Jul 2000
 * @version 1.11, 2000/08/16 Tidy Release 4 Aug 2000
 *
 */

public class Tidy implements java.io.Serializable {

    static final long serialVersionUID = -2794371560623987718L;

    private boolean       initialized = false;
    private PrintWriter   errout = null;   /* error output stream */
    private PrintWriter   stderr = null;
    private Configuration configuration = null;
    private String        inputStreamName = "InputStream";
    private int           parseErrors = 0;
    private int           parseWarnings = 0;

    public Tidy()
    {
        init();
    }

    public Configuration getConfiguration()
    {
        return configuration;
    }

    public PrintWriter getStderr()
    {
        return stderr;
    }

    /**
     * ParseErrors - the number of errors that occurred in the most
     * recent parse operation
     */

    public int getParseErrors()
    {
        return parseErrors;
    }

    /**
     * ParseWarnings - the number of warnings that occurred in the most
     * recent parse operation
     */

    public int getParseWarnings()
    {
        return parseWarnings;
    }

    /**
     * Errout - the error output stream
     */

    public PrintWriter getErrout()
    {
        return errout;
    }

    public void setErrout(PrintWriter errout)
    {
        this.errout = errout;
    }

    /**
     * Spaces - default indentation
     * @see org.w3c.tidy.Configuration#spaces
     */

    public void setSpaces(int spaces)
    {
        configuration.spaces = spaces;
    }

    public int getSpaces()
    {
        return configuration.spaces;
    }

    /**
     * Wraplen - default wrap margin
     * @see org.w3c.tidy.Configuration#wraplen
     */

    public void setWraplen(int wraplen)
    {
        configuration.wraplen = wraplen;
    }

    public int getWraplen()
    {
        return configuration.wraplen;
    }

    /**
     * CharEncoding
     * @see org.w3c.tidy.Configuration#CharEncoding
     */

    public void setCharEncoding(int charencoding)
    {
        configuration.CharEncoding = charencoding;
    }

    public int getCharEncoding()
    {
        return configuration.CharEncoding;
    }

    /**
     * Tabsize
     * @see org.w3c.tidy.Configuration#tabsize
     */

    public void setTabsize(int tabsize)
    {
        configuration.tabsize = tabsize;
    }

    public int getTabsize()
    {
        return configuration.tabsize;
    }

    /**
     * Errfile - file name to write errors to
     * @see org.w3c.tidy.Configuration#errfile
     */

    public void setErrfile(String errfile)
    {
        configuration.errfile = errfile;
    }

    public String getErrfile()
    {
        return configuration.errfile;
    }

    /**
     * Writeback - if true then output tidied markup
     * NOTE: this property is ignored when parsing from an InputStream.
     * @see org.w3c.tidy.Configuration#writeback
     */

    public void setWriteback(boolean writeback)
    {
        configuration.writeback = writeback;
    }

    public boolean getWriteback()
    {
        return configuration.writeback;
    }

    /**
     * OnlyErrors - if true normal output is suppressed
     * @see org.w3c.tidy.Configuration#OnlyErrors
     */

    public void setOnlyErrors(boolean OnlyErrors)
    {
        configuration.OnlyErrors = OnlyErrors;
    }

    public boolean getOnlyErrors()
    {
        return configuration.OnlyErrors;
    }

    /**
     * ShowWarnings - however errors are always shown
     * @see org.w3c.tidy.Configuration#ShowWarnings
     */

    public void setShowWarnings(boolean ShowWarnings)
    {
        configuration.ShowWarnings = ShowWarnings;
    }

    public boolean getShowWarnings()
    {
        return configuration.ShowWarnings;
    }

    /**
     * Quiet - no 'Parsing X', guessed DTD or summary
     * @see org.w3c.tidy.Configuration#Quiet
     */

    public void setQuiet(boolean Quiet)
    {
        configuration.Quiet = Quiet;
    }

    public boolean getQuiet()
    {
        return configuration.Quiet;
    }

    /**
     * IndentContent - indent content of appropriate tags
     * @see org.w3c.tidy.Configuration#IndentContent
     */

    public void setIndentContent(boolean IndentContent)
    {
        configuration.IndentContent = IndentContent;
    }

    public boolean getIndentContent()
    {
        return configuration.IndentContent;
    }

    /**
     * SmartIndent - does text/block level content effect indentation
     * @see org.w3c.tidy.Configuration#SmartIndent
     */

    public void setSmartIndent(boolean SmartIndent)
    {
        configuration.SmartIndent = SmartIndent;
    }

    public boolean getSmartIndent()
    {
        return configuration.SmartIndent;
    }

    /**
     * HideEndTags - suppress optional end tags
     * @see org.w3c.tidy.Configuration#HideEndTags
     */

    public void setHideEndTags(boolean HideEndTags)
    {
        configuration.HideEndTags = HideEndTags;
    }

    public boolean getHideEndTags()
    {
        return configuration.HideEndTags;
    }

    /**
     * XmlTags - treat input as XML
     * @see org.w3c.tidy.Configuration#XmlTags
     */

    public void setXmlTags(boolean XmlTags)
    {
        configuration.XmlTags = XmlTags;
    }

    public boolean getXmlTags()
    {
        return configuration.XmlTags;
    }

    /**
     * XmlOut - create output as XML
     * @see org.w3c.tidy.Configuration#XmlOut
     */

    public void setXmlOut(boolean XmlOut)
    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -