public class NoContentTransformer extends AbstractDocumentTransformer implements IXMLConfigurable
Get rid of the content stream and optionally store it as text into a metadata field instead.
If a toField
with the same name already exists for a document,
the value will be added to the end of the existing value list.
This class can be used both as a pre-parsing or post-parsing handler. To store the content in a field, make sure pre-parsing is of a text content-types.
<transformer class="com.norconex.importer.handler.transformer.impl.NoContentTransformer" toField="(Optionally store content into a field.)"> <restrictTo caseSensitive="[false|true]" field="(name of header/metadata field name to match)"> (regular expression of value to match) </restrictTo> <!-- multiple "restrictTo" tags allowed (only one needs to match) --> </transformer>
<transformer class="com.norconex.importer.handler.transformer.impl.NoContentTransformer"/>
The above example removes the content of all documents (leaving you with metadata only).
Constructor and Description |
---|
NoContentTransformer() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
String |
getToField() |
int |
hashCode() |
protected void |
loadHandlerFromXML(org.apache.commons.configuration.XMLConfiguration xml)
Loads configuration settings specific to the implementing class.
|
protected void |
saveHandlerToXML(EnhancedXMLStreamWriter writer)
Saves configuration settings specific to the implementing class.
|
void |
setToField(String toField) |
String |
toString() |
protected void |
transformApplicableDocument(String reference,
InputStream input,
OutputStream output,
ImporterMetadata metadata,
boolean parsed) |
transformDocument
addRestriction, addRestriction, addRestrictions, clearRestrictions, detectCharsetIfBlank, getRestrictions, isApplicable, loadFromXML, removeRestriction, removeRestriction, saveToXML
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
loadFromXML, saveToXML
public String getToField()
public void setToField(String toField)
protected void transformApplicableDocument(String reference, InputStream input, OutputStream output, ImporterMetadata metadata, boolean parsed) throws ImporterHandlerException
transformApplicableDocument
in class AbstractDocumentTransformer
ImporterHandlerException
protected void loadHandlerFromXML(org.apache.commons.configuration.XMLConfiguration xml) throws IOException
AbstractImporterHandler
loadHandlerFromXML
in class AbstractImporterHandler
xml
- xml configurationIOException
- could not load from XMLprotected void saveHandlerToXML(EnhancedXMLStreamWriter writer) throws XMLStreamException
AbstractImporterHandler
saveHandlerToXML
in class AbstractImporterHandler
writer
- the xml writerXMLStreamException
- could not save to XMLpublic boolean equals(Object other)
equals
in class AbstractImporterHandler
public int hashCode()
hashCode
in class AbstractImporterHandler
public String toString()
toString
in class AbstractImporterHandler
Copyright © 2009–2021 Norconex Inc.. All rights reserved.