Package org.ctan.markup.markdown
Class HtmlSanitizer
java.lang.Object
org.ctan.markup.markdown.HtmlSanitizer
This class filters HTML and allows only a restricted set of tags or
attributes to pass. The allowed constructs are defined within the enumeration
Tag
and the properties of the constants defined there.-
Constructor Summary
ConstructorsConstructorDescriptionHtmlSanitizer
(@NonNull MarkdownScanner in, @NonNull Writer out) This is the constructor forHtmlSanitizer
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
sanitize()
This method scans for embedded HTML and passes on only allowed tags and attributes.boolean
This method reads the complete input stream and processes all tags until the EOF is reached.void
This is the setter forbase
.
-
Constructor Details
-
HtmlSanitizer
This is the constructor forHtmlSanitizer
.- Parameters:
in
- the input reader; notnull
out
- the target writer; notnull
-
-
Method Details
-
sanitize
This method scans for embedded HTML and passes on only allowed tags and attributes. It stops after the first completed tag.- Returns:
true
iff everything went right- Throws:
IOException
- in case of an I/O error
-
sanitizeAll
This method reads the complete input stream and processes all tags until the EOF is reached. On syntax errors part of the input is skipped.- Returns:
true
iff a syntax error has been detected- Throws:
IOException
- in case of an I/O error
-
setBase
This is the setter forbase
.- Parameters:
base
- the new value for base
-