Example usage for com.google.gwt.dom.client BRElement TAG

List of usage examples for com.google.gwt.dom.client BRElement TAG

Introduction

In this page you can find the example usage for com.google.gwt.dom.client BRElement TAG.

Prototype

String TAG

To view the source code for com.google.gwt.dom.client BRElement TAG.

Click Source Link

Usage

From source file:com.google.wave.api.Blip.java

License:Apache License

/**
 * Converts the given {@code HTML} into robot compatible plaintext.
 *
 * @param html the {@code HTML} to convert.
 * @return a plain text version of the given {@code HTML}.
 */// w  ww.  j  a  v  a 2s  .c o m
private static String convertToPlainText(String html) {
    StringBuffer result = new StringBuffer();
    Matcher matcher = MARKUP_PATTERN.matcher(html);
    while (matcher.find()) {
        String replacement = "";
        String tag = matcher.group().substring(1, matcher.group().length() - 1).split(" ")[0];
        if (ParagraphElement.TAG.equalsIgnoreCase(tag) || BRElement.TAG.equalsIgnoreCase(tag)) {
            replacement = "\n";
        }
        matcher.appendReplacement(result, replacement);
    }
    matcher.appendTail(result);
    return result.toString();
}