Class CmsXmlContentErrorHandler

java.lang.Object
org.opencms.xml.content.CmsXmlContentErrorHandler

public class CmsXmlContentErrorHandler extends Object
Handler for issues found during XML content validation.

Since:
6.0.0
  • Constructor Details

  • Method Details

    • addError

      public void addError(I_CmsXmlContentValue value, String message)
      Adds an error message to the internal list of errors, also raised the "has errors" flag.

      Parameters:
      value - the value that contains the error
      message - the error message to add
    • addWarning

      public void addWarning(I_CmsXmlContentValue value, String message)
      Adds an warning message to the internal list of errors, also raised the "has warning" flag.

      Parameters:
      value - the value that contians the warning
      message - the warning message to add
    • getErrors

      Returns the map of validation errors.

      The map contains further maps. The key of the "first" map is the Locale of the language where issues where found. The key of the "second" map is a mapping from the element node name obtained with I_CmsXmlContentValue.getPath() to the error message which is a String.

      Returns:
      the map of validation errors
    • getErrors

      public Map<String,String> getErrors(Locale locale)
      Returns the Map of errors for the selected locale.

      Parameters:
      locale - the locale to get the errors for
      Returns:
      the Map of errors for the selected locale
    • getWarnings

      Returns the map of validation warnings.

      The map contains further maps. The key of the "first" map is the Locale of the language where issues where found. The key of the "second" map is a mapping from the element node name obtained with I_CmsXmlContentValue.getPath() to the error message which is a String.

      Returns:
      the map of validation warnings
    • getWarnings

      public Map<String,String> getWarnings(Locale locale)
      Returns the Map of warnings for the selected locale.

      Parameters:
      locale - the locale to get the warnings for
      Returns:
      the Map of warnings for the selected locale
    • hasErrors

      public boolean hasErrors()
      Returns true if the validated content had errors.

      Returns:
      true if the validated content had errors
    • hasErrors

      public boolean hasErrors(Locale locale)
      Returns true if there is at last one error in the selected locale.

      Parameters:
      locale - the locale to check
      Returns:
      true if there is at last one error in the selected locale
    • hasWarnings

      public boolean hasWarnings()
      Returns true if the validated content has warnings.

      Returns:
      true if the validated content had warnings
    • hasWarnings

      public boolean hasWarnings(Locale locale)
      Returns true if there is at last one warning in the selected locale.

      Parameters:
      locale - the locale to check
      Returns:
      true if there is at last one warning in the selected locale