📄 cmshtmlconverterconfig.java
字号:
/*
* File : $Source: /usr/local/cvs/opencms/src-modules/com/opencms/htmlconverter/CmsHtmlConverterConfig.java,v $
* Date : $Date: 2006/03/27 14:53:04 $
* Version: $Revision: 1.3 $
*
* 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 org.opencms.util.CmsStringUtil;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.StringTokenizer;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.tidy.Tidy;
/**
* Configuration class for CmsHtmlConverter, user defined configuration
* is parsed and used by CmsHtmlConverter.
* @author Andreas Zahner
* @version 0.6
*
* @deprecated Will not be supported past the OpenCms 6 release.
*/
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;
/** 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;
/** 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;
/** check if quotationmarks must be encoded. */
private boolean m_encodeQuotationmarks;
/** 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;
/** check if default values are used. */
private boolean m_replaceTagsUseDefaults;
/** 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;
/** check if default values are used. */
private boolean m_replaceBlocksUseDefaults;
/** 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;
/** check if default values are used. */
private boolean m_replaceStringsUseDefaults;
/** 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;
/**
* Default constructor.<p>
*/
protected CmsHtmlConverterConfig() {
// empty
}
/**
* Creates configuration from String.<p>
*
* @param confString String with XML configuration
*/
protected CmsHtmlConverterConfig(String confString) {
init(confString);
}
/**
* Creates configuration from InputStream.<p>
*
* @param in InputStream with XML configuration
*/
protected CmsHtmlConverterConfig(InputStream in) {
init(in);
}
/**
* Returns all tags which are removed from html input.<p>
*
* @return HashSet with tags
*/
protected HashSet getRemoveTags() {
return m_removeTags;
}
/**
* Returns all blocks which are removed from html input.<p>
*
* @return HashSet with blocks
*/
protected HashSet getRemoveBlocks() {
return m_removeBlocks;
}
/**
* Returns all inline tags defined in configuration.<p>
*
* @return HashSet with inline tags
*/
protected HashSet getInlineTags() {
return m_inlineTags;
}
/**
* Returns all Strings which are replaced in run #1.<p>
*
* @return ArrayList with CmsHtmlConverterObjectReplaceContent
*/
protected ArrayList getReplaceContent() {
return m_replaceContent;
}
/**
* Returns extended characters which are replaced in text nodes.<p>
*
* @return ArrayList with CmsHtmlConverterObjectReplaceExtendedChars
*/
protected ArrayList getReplaceExtendedChars() {
return m_replaceExtendedChars;
}
/**
* Returns all Strings which are replaced in run #2.<p>
*
* @return ArrayList with CmsHtmlConverterObjectReplaceStrings
*/
protected ArrayList getReplaceStrings() {
return m_replaceStrings;
}
/**
* Returns all tags which are replaced in html input.<p>
*
* @return ArrayList with CmsHtmlConverterObjectReplaceTags
*/
protected ArrayList getReplaceTags() {
return m_replaceTags;
}
/**
* Returns all Blocks which are replaced in html input.<p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -