Package org.apache.tika.parser.html
Class IdentityHtmlMapper
java.lang.Object
org.apache.tika.parser.html.IdentityHtmlMapper
- All Implemented Interfaces:
HtmlMapper
Alternative HTML mapping rules that pass the input HTML as-is without any
modifications.
- Since:
- Apache Tika 0.8
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisDiscardElement(String name) Checks whether all content within the given HTML element should be discarded instead of including it in the parse output.mapSafeAttribute(String elementName, String attributeName) Maps HTML attribute names to Tika's XHTML dialect.mapSafeElement(String name) Maps HTML element names to Tika's XHTML dialect.
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
IdentityHtmlMapper
public IdentityHtmlMapper()
-
-
Method Details
-
isDiscardElement
Description copied from interface:HtmlMapperChecks whether all content within the given HTML element should be discarded instead of including it in the parse output.- Specified by:
isDiscardElementin interfaceHtmlMapper- Parameters:
name- HTML element name (upper case)- Returns:
trueif content inside the named element should be ignored,falseotherwise
-
mapSafeAttribute
Description copied from interface:HtmlMapperMaps HTML attribute names to Tika's XHTML dialect. If the given attribute is not part of that dialect for this element, this method returnsnull, and the attribute is dropped. Attribute values are not inspected. This method assumes that the element name is valid and normalised.- Specified by:
mapSafeAttributein interfaceHtmlMapper- Parameters:
elementName- HTML element name (lower case)attributeName- HTML attribute name (lower case)- Returns:
- XHTML attribute name (lower case), or
nullif the attribute is not in the output dialect
-
mapSafeElement
Description copied from interface:HtmlMapperMaps HTML element names to Tika's XHTML dialect. If the given element is not part of that dialect, this method returnsnulland the element is dropped but the content inside it is still processed. "Safe" here means valid in the output dialect; this is not a browser sanitizer, and attribute values are passed through unchanged. See theHtmlMapper.isDiscardElement(String)method for a way to discard the entire contents of an element.- Specified by:
mapSafeElementin interfaceHtmlMapper- Parameters:
name- HTML element name (upper case)- Returns:
- XHTML element name (lower case), or
nullif the element is not in the output dialect
-