com.clickntap.tool.html.TextParserCallBack Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of click_framework Show documentation
Show all versions of click_framework Show documentation
Java Framework based on Spring Framework, Freemarker and Simplicity
package com.clickntap.tool.html;
import java.io.Writer;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML.Tag;
import javax.swing.text.html.HTMLEditorKit.ParserCallback;
import com.clickntap.utils.ConstUtils;
public class TextParserCallBack extends ParserCallback {
private Writer writer;
public TextParserCallBack(Writer writer) {
this.writer = writer;
}
public void handleStartTag(Tag tag, MutableAttributeSet attributeSet, int index) {
try {
if (tag.breaksFlow())
writer.write(ConstUtils.SPACE);
} catch (Exception e) {
}
}
public void handleEndTag(Tag tag, int index) {
try {
if (tag.breaksFlow())
writer.write(ConstUtils.SPACE);
} catch (Exception e) {
}
}
public void handleText(char[] text, int index) {
try {
writer.write(text);
} catch (Exception e) {
}
}
public void handleSimpleTag(Tag tag, MutableAttributeSet attributeSet, int index) {
try {
if (tag.breaksFlow())
writer.write(ConstUtils.SPACE);
} catch (Exception e) {
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy