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 TypeMethodDescriptionbooleansanitize()This method scans for embedded HTML and passes on only allowed tags and attributes.booleanThis method reads the complete input stream and processes all tags until the EOF is reached.voidThis is the setter forbase.
-
Constructor Details
-
HtmlSanitizer
This is the constructor forHtmlSanitizer.- Parameters:
in- the input reader; notnullout- 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:
trueiff 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:
trueiff 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
-