code: public String ruleMatchesToXml(List<RuleMatch> ruleMatches, String text, int contextSize, ApiPrintMode xmlMode, Language lang, List<String> unknownWords) {
      String xmlSnippet = ruleMatchesToXmlSnippet(ruleMatches, text, contextSize);
      switch (xmlMode) {
        case START_API:
          return getXmlStart(lang, null) + xmlSnippet;
        case CONTINUE_API:
          return xmlSnippet;
        case END_API:
          return xmlSnippet + getXmlUnknownWords(unknownWords) + getXmlEnd();
        case NORMAL_API:
          return getXmlStart(lang, null) + xmlSnippet + getXmlUnknownWords(unknownWords) + getXmlEnd();
      }
      throw new IllegalArgumentException("Unknown XML mode: " + xmlMode);
    }
docs: Get an XML representation of the given rule matches.
  
  @param text the original text that was checked, used to get the context of the matches
  @param contextSize the desired context size in characters
  @param unknownWords unknown words to be printed in a separated list
  @since 3.0