Package org.opencms.xml.content
Class CmsXmlContentErrorHandler
java.lang.Object
org.opencms.xml.content.CmsXmlContentErrorHandler
Handler for issues found during XML content validation.
- Since:
- 6.0.0
-
Constructor Summary
ConstructorDescriptionCreate a new instance of the validation handler. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addError
(I_CmsXmlContentValue value, String message) Adds an error message to the internal list of errors, also raised the "has errors" flag.void
addWarning
(I_CmsXmlContentValue value, String message) Adds an warning message to the internal list of errors, also raised the "has warning" flag.Returns the map of validation errors.Returns the Map of errors for the selected locale.Returns the map of validation warnings.getWarnings
(Locale locale) Returns the Map of warnings for the selected locale.boolean
Returns true if the validated content had errors.boolean
Returnstrue
if there is at last one error in the selected locale.boolean
Returns true if the validated content has warnings.boolean
hasWarnings
(Locale locale) Returnstrue
if there is at last one warning in the selected locale.
-
Constructor Details
-
CmsXmlContentErrorHandler
public CmsXmlContentErrorHandler()Create a new instance of the validation handler.
-
-
Method Details
-
addError
Adds an error message to the internal list of errors, also raised the "has errors" flag.- Parameters:
value
- the value that contains the errormessage
- the error message to add
-
addWarning
Adds an warning message to the internal list of errors, also raised the "has warning" flag.- Parameters:
value
- the value that contians the warningmessage
- 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 withI_CmsXmlContentValue.getPath()
to the error message which is a String.- Returns:
- the map of validation errors
-
getErrors
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 withI_CmsXmlContentValue.getPath()
to the error message which is a String.- Returns:
- the map of validation warnings
-
getWarnings
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
Returns true if the validated content had errors.- Returns:
- true if the validated content had errors
-
hasErrors
Returnstrue
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
Returns true if the validated content has warnings.- Returns:
- true if the validated content had warnings
-
hasWarnings
Returnstrue
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
-