public void endElement(String uri,
String name,
String raw) throws SAXException {
if (this.tags.containsKey(name)) {
String toBeNormalized = this.endTextRecording();
try {
this.normalize(toBeNormalized);
} catch (ProcessingException e) {
e.printStackTrace();
}
}
super.endElement(uri, name, raw);
}
React on endElement calls that contain a tag to be
tidied and run Neko on it, otherwise passthru. |
public void setup(SourceResolver resolver,
Map objectModel,
String src,
Parameters par) throws IOException, SAXException, ProcessingException {
super.setup(resolver, objectModel, src, par);
String tagsParam = par.getParameter("tags", "");
if (getLogger().isDebugEnabled()) {
getLogger().debug("tags: " + tagsParam);
}
this.tags = new HashMap();
StringTokenizer tokenizer = new StringTokenizer(tagsParam, ",");
while (tokenizer.hasMoreElements()) {
String tok = tokenizer.nextToken().trim();
this.tags.put(tok, tok);
}
}
Setup this component, passing the tag names to be tidied. |
public void startElement(String uri,
String name,
String raw,
Attributes attr) throws SAXException {
super.startElement(uri, name, raw, attr);
if (this.tags.containsKey(name)) {
this.startTextRecording();
}
}
Start buffering text if inside a tag to be normalized,
passthru otherwise. |