1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.xml.html

File HTMLCleaner.java

 

Code metrics

0
0
0
1
66
11
0
-
-
0
-

Classes

Class Line # Actions
HTMLCleaner 34 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.xml.html;
21   
22    import java.io.Reader;
23   
24    import org.w3c.dom.Document;
25    import org.xwiki.component.annotation.Role;
26   
27    /**
28    * Transforms any HTML content into valid XHTML that can be fed to the XHTML Parser for example.
29    *
30    * @version $Id: 7a5aea04496574c79f20aa94ecac9c1efc07d527 $
31    * @since 1.6M1
32    */
33    @Role
 
34    public interface HTMLCleaner
35    {
36    /**
37    * Transforms any HTML content into valid XHTML that can be fed to the XHTML Parser for example.
38    * A default configuration is applied for cleaning the original HTML (see {@link #getDefaultConfiguration()}).
39    *
40    * @param originalHtmlContent the original content (HTML) to clean
41    * @return the cleaned HTML as a w3c DOM (this allows further transformations if needed)
42    */
43    Document clean(Reader originalHtmlContent);
44   
45    /**
46    * Transforms any HTML content into valid XHTML. A specific cleaning configuration can be passed to control
47    * the cleaning process.
48    *
49    * @param originalHtmlContent the original HTML content to be cleaned.
50    * @param configuration the configuration to use for cleaning the HTML content
51    * @return the cleaned HTML as a w3c DOM
52    * @since 1.8.1
53    */
54    Document clean(Reader originalHtmlContent, HTMLCleanerConfiguration configuration);
55   
56    /**
57    * Allows getting the default configuration that will be used thus allowing the user to configure it like adding
58    * some more filters before or after or even remove some filters to completely control what filters will be
59    * executed. This is to be used for very specific use cases. In the majority of cases you should instead use the
60    * clean API that doesn't require passing a configuration.
61    *
62    * @return the default configuration that will be used to clean the original HTML
63    * @since 1.8.1
64    */
65    HTMLCleanerConfiguration getDefaultConfiguration();
66    }