public class ReplaceTagger extends Object implements IDocumentTagger, IXMLConfigurable
Can be used both as a pre-parse or post-parse handler.
XML configuration usage:
<tagger class="com.norconex.importer.tagger.impl.ReplaceTagger"> <replace fromName="sourceFieldName" toName="targetFieldName" regex="[false|true]"> <fromValue>Source Value</fromValue> <toValue>Target Value</toValue> </replace> <!-- multiple replace tags allowed --> </tagger>
Modifier and Type | Class and Description |
---|---|
class |
ReplaceTagger.Replacement |
Constructor and Description |
---|
ReplaceTagger() |
Modifier and Type | Method and Description |
---|---|
void |
addReplacement(String fromValue,
String toValue,
String fromName) |
void |
addReplacement(String fromValue,
String toValue,
String fromName,
boolean regex) |
void |
addReplacement(String fromValue,
String toValue,
String fromName,
String toName) |
void |
addReplacement(String fromValue,
String toValue,
String fromName,
String toName,
boolean regex) |
boolean |
equals(Object obj) |
List<ReplaceTagger.Replacement> |
getReplacements() |
int |
hashCode() |
void |
loadFromXML(Reader in) |
void |
removeReplacement(String fromName) |
void |
saveToXML(Writer out) |
void |
tagDocument(String reference,
InputStream document,
Properties metadata,
boolean parsed)
Tags a document with extra metadata information.
|
String |
toString() |
public void tagDocument(String reference, InputStream document, Properties metadata, boolean parsed) throws IOException
IDocumentTagger
tagDocument
in interface IDocumentTagger
reference
- document reference (e.g. URL)document
- documentmetadata
- document metadataparsed
- whether the document has been parsed already or not (a
parsed document should normally be text-based)IOException
- problem reading the documentpublic List<ReplaceTagger.Replacement> getReplacements()
public void removeReplacement(String fromName)
public void addReplacement(String fromValue, String toValue, String fromName, boolean regex)
public void addReplacement(String fromValue, String toValue, String fromName, String toName)
public void addReplacement(String fromValue, String toValue, String fromName, String toName, boolean regex)
public void loadFromXML(Reader in) throws IOException
loadFromXML
in interface IXMLConfigurable
IOException
public void saveToXML(Writer out) throws IOException
saveToXML
in interface IXMLConfigurable
IOException
Copyright © 2009-2014 Norconex Inc.. All Rights Reserved.