code: protected void addValidationRule(
          CmsXmlContentDefinition contentDefinition,
          String elementName,
          String regex,
          String message,
          boolean isWarning)
      throws CmsXmlException {
  
          if (contentDefinition.getSchemaType(elementName) == null) {
              throw new CmsXmlException(
                  Messages.get().container(Messages.ERR_XMLCONTENT_INVALID_ELEM_VALIDATION_1, elementName));
          }
  
          if (isWarning) {
              m_validationWarningRules.put(elementName, regex);
              if (message != null) {
                  m_validationWarningMessages.put(elementName, message);
              }
          } else {
              m_validationErrorRules.put(elementName, regex);
              if (message != null) {
                  m_validationErrorMessages.put(elementName, message);
              }
          }
      }
docs: Adds a validation rule for a specified element.<p>
  
  @param contentDefinition the XML content definition this XML content handler belongs to
  @param elementName the element name to add the rule to
  @param regex the validation rule regular expression
  @param message the message in case validation fails (may be null)
  @param isWarning if true, this rule is used for warnings, otherwise it's an error
  
  @throws CmsXmlException in case an unknown element name is used