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

📄 cmshtmlconverterconfig.java

📁 java 编写的程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
* File   : $Source: /usr/local/cvs/opencms/src/com/opencms/htmlconverter/CmsHtmlConverterConfig.java,v $
* Date   : $Date: 2002/02/21 16:15:40 $
* Version: $Revision: 1.2 $
*
* This library is part of OpenCms -
* the Open Source Content Mananagement System
*
* Copyright (C) 2001  The OpenCms Group
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
* Lesser General Public License for more details.
*
* For further information about OpenCms, please see the
* OpenCms Website: http://www.opencms.org
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

package com.opencms.htmlconverter;

import java.util.*;
import org.w3c.tidy.Tidy;
import org.w3c.dom.*;
import java.io.*;

/**
 * Configuration class for CmsHtmlConverter, user defined configuration
 * is parsed and used by CmsHtmlConverter.
 * @author Andreas Zahner
 * @version 0.6
 */
final class CmsHtmlConverterConfig {

    /** Comment node in xml-configuration */
    private static final int C_COMMENT_NODE = 0;
    /** "ConverterConfig" node in xml-configuration */
    private static final int C_CONFIG_NODE = 1;
    /** "defaults" node in xml-configuration */
    private static final int C_DEFAULT_NODE = 10;
    /** "replacecontent" node in xml-configuration */
    private static final int C_REPLACECONTENT_NODE = 11;
    /** "inlinetags" node in xml-configuration */
    private static final int C_INLINETAG_NODE = 12;
    /** "removetags" node in xml-configuration */
    private static final int C_REMOVETAG_NODE = 13;
    /** "removeblocks" node in xml-configuration */
    private static final int C_REMOVEBLOCK_NODE = 14;
    /** "replacetags" node in xml-configuration */
    private static final int C_REPLACETAG_NODE = 15;
    /** "replaceblocks" node in xml-configuration */
    private static final int C_REPLACEBLOCK_NODE = 16;
    /** "replacestrings" node in xml-configuration */
    private static final int C_REPLACESTRING_NODE = 17;

    /** "xhtmloutput" node in defaults: xml-configuration */
    private static final int C_XHTMLOUTPUT_NODE = 20;
    /** "globalprefix" node in defaults: xml-configuration */
    private static final int C_GLOBALPREFIX_NODE = 21;
    /** "globalsuffix" node in defaults: xml-configuration */
    private static final int C_GLOBALSUFFIX_NODE = 22;
    /** "globaladdeveryline" node in defaults: xml-configuration */
    private static final int C_GLOBALADDEVERYLINE_NODE = 23;
    /** "usebrackets" node in defaults: xml-configuration */
    private static final int C_USEBRACKETS_NODE = 24;
    /** "encodequotationmarks" node in defaults: xml-configuration */
    private static final int C_ENCODEQUOTATIONMARKS_NODE = 25;

    /** "addeveryline" node in replacenodes: xml-configuration */
    private static final int C_ADDEVERYLINE_NODE = 30;
    /** "prefix" node in replacenodes: xml-configuration */
    private static final int C_PREFIX_NODE = 31;
    /** "suffix" node in replacenodes: xml-configuration */
    private static final int C_SUFFIX_NODE = 32;
    /** "tag" node in replacenodes: xml-configuration */
    private static final int C_TAG_NODE = 33;
    /** "string" node in replacenodes: xml-configuration */
    private static final int C_STRING_NODE = 34;

    /** check if output has to be XHTML */
    private boolean m_xhtmlOutput = false;
    /** stores global prefix */
    private String m_globalPrefix = "";
    /** stores global suffix */
    private String m_globalSuffix = "";
    /** check if prefix and suffix have to be added to every new line */
    private boolean m_globalAddEveryLine = false;
    /** code for html bracket "<" */
    private String m_openBracket = "";
    /** code for html bracket ">" */
    private String m_closeBracket = "";
    /** check if brackets are used */
    private boolean m_useBrackets = false;
    /** check if quotationmarks must be encoded */
    private boolean m_encodeQuotationmarks = false;
    /** stores code for quotationmarks */
    private String m_quotationmark = "";
    /** stores prefix for replacetags */
    private String m_replaceTagsPrefix = "";
    /** stores suffix for replacetags */
    private String m_replaceTagsSuffix = "";
    /** check if replaced content needs new lines */
    private boolean m_replaceTagsAddEveryLine = false;
    /** check if default values are used */
    private boolean m_replaceTagsUseDefaults = false;

    /** stores prefix for replaceblocks */
    private String m_replaceBlocksPrefix = "";
    /** stores suffix for replaceblocks */
    private String m_replaceBlocksSuffix = "";
    /** check if replaced content needs new lines */
    private boolean m_replaceBlocksAddEveryLine = false;
    /** check if default values are used */
    private boolean m_replaceBlocksUseDefaults = false;

    /** stores prefix for replacestrings */
    private String m_replaceStringsPrefix = "";
    /** stores suffix for replacestrings */
    private String m_replaceStringsSuffix = "";
    /** check if replaced content needs new lines */
    private boolean m_replaceStringsAddEveryLine = false;
    /** check if default values are used */
    private boolean m_replaceStringsUseDefaults = false;

    /** list with objects which will be replaced in run #1 */
    private ArrayList m_replaceContent = new ArrayList();
    /** list with tags to be removed */
    private HashSet m_removeTags = new HashSet();
    /** list with blocks to be removed */
    private HashSet m_removeBlocks = new HashSet();
    /** list with all inline tags */
    private HashSet m_inlineTags = new HashSet();
    /** list with extended chars which are replaced in text nodes */
    private ArrayList m_replaceExtendedChars = new ArrayList();
    /** list with Strings whihch are replaced */
    private ArrayList m_replaceStrings = new ArrayList();
    /** list with tags which are replaced */
    private ArrayList m_replaceTags = new ArrayList();
    /** list with blocks which are replaced */
    private ArrayList m_replaceBlocks = new ArrayList();

    /** temporary list of replacecontent */
    private ArrayList m_tempReplaceContent = new ArrayList();
    /** temporary list of replacestrings */
    private ArrayList m_tempReplaceStrings = new ArrayList();
    /** temporary list of replacetags */
    private ArrayList m_tempReplaceTags = new ArrayList();
    /** temporary list of replaceblocks */
    private ArrayList m_tempReplaceBlocks = new ArrayList();

    /** instance of CmsHtmlConverterTools */
    private CmsHtmlConverterTools m_tools = new CmsHtmlConverterTools();

    /** to check if instance has already been configured */
    private boolean m_isConfigured = false;

    /**
     * default constructor
     */
    protected CmsHtmlConverterConfig() {
    }

    /**
     * creates configuration from String
     * @param confString String with XML configuration
     */
    protected void CmsHtmlConverterConfig(String confString) {
        init(confString);
    }

    /**
     * creates configuration from InputStream
     * @param in InputStream with XML configuration
     */
    protected void CmsHtmlConverterConfig(InputStream in) {
        init(in);
    }

    /**
     * returns all tags which are removed from html input
     * @return HashSet with tags
     */
    protected HashSet getRemoveTags() {
        return m_removeTags;
    }

    /**
     * returns all blocks which are removed from html input
     * @return HashSet with blocks
     */
    protected HashSet getRemoveBlocks() {
        return m_removeBlocks;
    }

    /**
     * returns all inline tags defined in configuration
     * @return HashSet with inline tags
     */
    protected HashSet getInlineTags() {
        return m_inlineTags;
    }

    /**
     * returns all Strings which are replaced in run #1
     * @return ArrayList with CmsHtmlConverterObjectReplaceContent
     */
    protected ArrayList getReplaceContent() {
        return m_replaceContent;
    }

    /**
     * returns extended characters which are replaced in text nodes
     * @return ArrayList with CmsHtmlConverterObjectReplaceExtendedChars
     */
    protected ArrayList getReplaceExtendedChars() {
        return m_replaceExtendedChars;
    }

    /**
     * returns all Strings which are replaced in run #2
     * @return ArrayList with CmsHtmlConverterObjectReplaceStrings
     */
    protected ArrayList getReplaceStrings() {
        return m_replaceStrings;
    }

    /**

⌨️ 快捷键说明

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