code: static ComposableBody fromStaticBody(final StaticBody body)
      throws BOSHException {
          String raw = body.toXML();
          Matcher matcher = BOSH_START.matcher(raw);
          if (!matcher.find()) {
              throw(new BOSHException(
                      "Could not locate 'body' element in XML.  The raw XML did"
                      + " not match the pattern: " + BOSH_START));
          }
          String payload;
          if (">".equals(matcher.group(1))) {
              int first = matcher.end();
              int last = raw.lastIndexOf("</");
              if (last < first) {
                  last = first;
              }
              payload = raw.substring(first, last);
          } else {
              payload = "";
          }
  
          return new ComposableBody(body.getAttributes(), payload);
      }
docs: Parse a static body instance into a composable instance.  This is an
  expensive operation and should not be used lightly.
  <p/>
  The current implementation does not obtain the payload XML by means of
  a proper XML parser.  It uses some string pattern searching to find the
  first @{code body} element and the last element's closing tag.  It is
  assumed that the static body's XML is well formed, etc..  This
  implementation may change in the future.
  
  @param body static body instance to convert
  @return composable body instance
  @throws BOSHException