Skip to main content

Hyper Text Processor

Posted by evanx on March 22, 2007 at 9:19 AM PDT

In the HTML Builder prequel,
we generated a HTML artifacts for QHyperTextProcessorProperties.

So let's meet this QHyperTextProcessor itself, even if it's messy and not generally useful, but just a hack to serve
the random purposes of this author, for this so-called trilogy.

href="https://aptframework.dev.java.net/hyper/textProcessor.html">

border="0" width="32" height="32" align="left" hspace="8"/>
Click here to read "Hyper Text Processor"

from the "Hyper Beans" part of a trilogy in 42 parts"

style="text-decoration: none;">



Code Snippet

QHyperTextProcessor processes a document in toto, given it's text.

public class QHyperTextProcessor {
    protected QHyperTextProcessorProperties properties =
            dependencyManager.getInstance(QHyperTextProcessorProperties.class);
   
    protected String text;
    protected QStringBuilder stringBuilder = new QStringBuilder();
    protected QTextState state = noState;
   
    public QHyperTextProcessor(String text) {
        this.text = text;
    }
    ...
    public String processText() {
        for (String string : stringHelper.splitString(text, "\n")) {
            try {
                processTextLine(string);
            } catch (Throwable e) {
                throw new QWrappedRuntimeException(e, null, string);
            }
        }
        return stringBuilder.toString();
    }
}

where we split the text up into lines, and invoke processTextLine() with
each line of text in the file.


style="text-decoration: none;">
style="text-decoration: none;">
style="text-decoration: none;">