code: public void parse(CharSequence in, Appendable out) throws IOException, HttpErrorPage {
          ParserContextImpl ctx = new ParserContextImpl(out, httpRequest, httpResponse);
          Matcher matcher = pattern.matcher(in);
          int currentPosition = 0;
          while (matcher.find()) {
              String tag = matcher.group();
              ctx.characters(in, currentPosition, matcher.start());
              currentPosition = matcher.end();
              if (ctx.isCurrentTagEnd(tag)) {
                  // check if this is the end tag for current element
                  LOG.info("Processing end tag {}", tag);
                  ctx.endElement(tag);
              } else {
                  // if not, it is an opening tag for a new element
                  LOG.info("Processing start tag {}", tag);
                  ElementType type = null;
                  for (ElementType t : elementTypes) {
                      if (t.isStartTag(tag)) {
                          type = t;
                          break;
                      }
                  }
                  Element element = type.newInstance();
                  ctx.startElement(type, element, tag);
                  if (type.isSelfClosing(tag)) {
                      ctx.endElement(tag);
                  }
  
              }
          }
          // we reached the end of input
          ctx.characters(in, currentPosition, in.length());
      }
docs: Parses all the CharSequence.
  
  @param in
  The CharSequence to parse
  @param out
  The Writable to write the result to
  @throws IOException
  @throws HttpErrorPage