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

📄 cmshtmlconverterconfig.java

📁 java 编写的程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     * returns all tags which are replaced in html input
     * @return ArrayList with CmsHtmlConverterObjectReplaceTags
     */
    protected ArrayList getReplaceTags() {
        return m_replaceTags;
    }

    /**
     * returns all Blocks which are replaced in html input
     * @return ArrayList with CmsHtmlConverterObjectReplaceBlocks
     */
    protected ArrayList getReplaceBlocks() {
        return m_replaceBlocks;
    }

    /**
     * returns boolean if output is in XHTML format
     * @return true, if output has to be XHTML, otherwise false
     */
    protected boolean getXhtmlOutput() {
        return m_xhtmlOutput;
    }

    /**
     * returns global prefix defined in configuration
     * @return String with global prefix
     */
    protected String getGlobalPrefix() {
        return m_globalPrefix;
    }

    /**
     * returns global suffix defined in configuration
     * @return String with global suffix
     */
    protected String getGlobalSuffix() {
        return m_globalSuffix;
    }

    /**
     * returns boolean if global prefix and suffix have to be added to every new line
     * @return true, if prefix and suffix are added in every new line, otherwise false
     */
    protected boolean getGlobalAddEveryLine() {
        return m_globalAddEveryLine;
    }

    /**
     * returns boolean if encoded brackets are used
     * @return true, when encoded brackets are defined, otherwise false
     */
    protected boolean getUseBrackets() {
        return m_useBrackets;
    }

    /**
     * returns boolean if quotationmarks must be encoded
     * @return true, when quotationmarks must be encoded
     */
    protected boolean getEncodeQuotationmarks() {
        return m_encodeQuotationmarks;
    }

    /**
     * returns the String for quotationmarks
     * @return String with value for quotationmarks
     */
    protected String getQuotationmark() {
        return m_quotationmark;
    }

    /**
     * adds new object to ArrayList m_replaceTags
     * @param prefix prefix String
     * @param tagName tagname String
     * @param attributeName attributeName String
     * @param attributeValue attributeNalue String
     * @param replaceStartTag replaceStartTag String
     * @param replaceEndTag replaceEndTag String
     * @param suffix suffix String
     * @param getReplaceFromAttrs getReplaceFromAttrs boolean
     * @param startAttribute startAttribute String
     * @param endAttribute endAttribute String
     * @return true if object was successfully added, otherwise false
     */
    protected boolean addObjectReplaceTag(String prefix, String tagName,
            String attributeName, String attributeValue, String replaceStartTag,
            String replaceEndTag, String suffix, boolean getReplaceFromAttrs,
            String startAttribute, String endAttribute, String parameter, boolean replaceParamAttr) {
        return m_replaceTags.add(new CmsHtmlConverterObjectReplaceTags(prefix,tagName,
                attributeName,attributeValue,replaceStartTag,replaceEndTag,
                suffix,getReplaceFromAttrs,startAttribute,endAttribute,parameter,replaceParamAttr));
    }

    /**
     * removes object from position index from ArrayList m_replaceTags
     * @param index index of removed object
     */
    protected void removeObjectReplaceTag(int index) {
        m_replaceTags.remove(index);
    }

    /**
     * adds new object to ArrayList m_replaceBlocks
     * @param prefix prefix String
     * @param tagName tagname String
     * @param attributeName attributeName String
     * @param attributeValue attributeNalue String
     * @param replaceString replaceString String
     * @param suffix suffix String
     * @param getReplaceFromAttrs getReplaceFromAttrs boolean
     * @param replaceAttribute replaceAttribute String
     * @return true if object was successfully added, otherwise false
     */
    protected boolean addObjectReplaceBlock(String prefix, String tagName,
            String attributeName, String attributeValue, String replaceString,
            String suffix, boolean getReplaceFromAttrs, String replaceAttribute, String parameter) {
        return m_replaceBlocks.add(new CmsHtmlConverterObjectReplaceBlocks(prefix,tagName,
                attributeName,attributeValue,replaceString,suffix,
                getReplaceFromAttrs,replaceAttribute,parameter));
    }

    /**
     * removes object from position index from ArrayList m_replaceBlocks
     * @param index index of removed object
     */
    protected void removeObjectReplaceBlock(int index) {
        m_replaceBlocks.remove(index);
    }

    /**
     * scans a String for coded bracket subStrings and replaces them
     * @param content String to scan
     * @return String with real "<" and ">"
     */
    protected String scanBrackets(String content) {
        content = m_tools.replaceString(content,m_openBracket,"<");
        content = m_tools.replaceString(content,m_closeBracket,">");
        return content;
    }

    /**
     * initialises configuration from String
     * @param confString String with XML configuration
     */
    protected void init(String confString) {
        InputStream in = new ByteArrayInputStream(confString.getBytes());
        init(in);
    }

    /**
     * initialises configuration from InputStream
     * @param in InputStream with XML configuration
     */
    protected void init(InputStream in) {
        Node node;
        Tidy tidy = new Tidy();
        /* initialise Tidy */
        tidy.setXmlTags(true);
        tidy.setQuiet(true);
        tidy.setOnlyErrors(true);
        tidy.setShowWarnings(false);
        /* if converter was configured, clear previous configuration */
        if (m_isConfigured) {
            clearConfiguration();
        }
        node = tidy.parseDOM(in,null);
        parseConfig(node);
        buildObjects();
        m_isConfigured = true;
    }

    /**
     * clears all variables and objects if the configuration is redefined
     */
    private void clearConfiguration() {
        m_globalAddEveryLine = false;
        m_useBrackets = false;
        m_globalPrefix = "";
        m_globalSuffix = "";
        m_openBracket = "";
        m_closeBracket = "";
        m_encodeQuotationmarks = false;
        m_quotationmark = "";
        m_replaceTagsPrefix = "";
        m_replaceTagsSuffix = "";
        m_replaceTagsAddEveryLine = false;
        m_replaceTagsUseDefaults = false;
        m_replaceBlocksPrefix = "";
        m_replaceBlocksSuffix = "";
        m_replaceBlocksAddEveryLine = false;
        m_replaceBlocksUseDefaults = false;
        m_replaceStringsPrefix = "";
        m_replaceStringsSuffix = "";
        m_replaceStringsAddEveryLine = false;
        m_replaceStringsUseDefaults = false;
        m_tempReplaceContent.clear();
        m_tempReplaceStrings.clear();
        m_tempReplaceTags.clear();
        m_tempReplaceBlocks.clear();
        m_replaceContent.clear();
        m_removeTags.clear();
        m_removeBlocks.clear();
        m_inlineTags.clear();
        m_replaceExtendedChars.clear();
        m_replaceStrings.clear();
        m_replaceTags.clear();
        m_replaceBlocks.clear();
        m_isConfigured = false;
    }

    /**
     * builds all objects after XML configuration was parsed
     */
    private void buildObjects() {
        boolean added = true;
        /* scan global prefix and suffix for brackets */
        if (m_useBrackets) {
            m_globalPrefix = scanBrackets(m_globalPrefix);
            m_globalSuffix = scanBrackets(m_globalSuffix);
        }
        /* set normal quotationmarks, if no encoding is required */
        if (!m_encodeQuotationmarks) {
            m_quotationmark = "\"";
        }
        /* builds ArrayList m_replaceContent */
        buildObjectReplaceContent();
        /* builds ArrayList m_replaceTags */
        buildObjectReplaceTags();
        /* builds ArrayList m_replaceBlocks */
        buildObjectReplaceBlocks();
        /* builds ArrayList m_replaceStrings */
        buildObjectReplaceStrings();
        /* build ArrayList m_extendedChars */
        String Chars = "

⌨️ 快捷键说明

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