Package org.apache.struts2.validator
Class DefaultValidatorFileParser
java.lang.Object
org.apache.struts2.validator.DefaultValidatorFileParser
- All Implemented Interfaces:
ValidatorFileParser
Parse the validation file. (eg. MyAction-validation.xml, MyAction-actionAlias-validation.xml)
to return a List of ValidatorConfig encapsulating the validator information.
- Author:
- Jason Carreira, James House, tm_jee ( tm_jee (at) yahoo.co.uk ), Rob Harrop, Rene Gielen, Martin Gilday
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetTextValue
(Element valueEle) Extract trimmed text value from the given DOM element, ignoring XML comments.parseActionValidatorConfigs
(ValidatorFactory validatorFactory, InputStream is, String resourceName) Parse resource for a list of ValidatorConfig objects (configuring which validator(s) are being applied to a particular field etc.)void
parseValidatorDefinitions
(Map<String, String> validators, InputStream is, String resourceName) Parses validator definitions (register various validators with XWork).void
void
-
Constructor Details
-
DefaultValidatorFileParser
public DefaultValidatorFileParser()
-
-
Method Details
-
setMultiTextvalueSeparator
-
getMultiTextvalueSeparator
-
setObjectFactory
-
parseActionValidatorConfigs
public List<ValidatorConfig> parseActionValidatorConfigs(ValidatorFactory validatorFactory, InputStream is, String resourceName) Description copied from interface:ValidatorFileParser
Parse resource for a list of ValidatorConfig objects (configuring which validator(s) are being applied to a particular field etc.)- Specified by:
parseActionValidatorConfigs
in interfaceValidatorFileParser
- Parameters:
validatorFactory
- a validator factoryis
- input stream to the resourceresourceName
- file name of the resource- Returns:
- List list of ValidatorConfig
-
parseValidatorDefinitions
public void parseValidatorDefinitions(Map<String, String> validators, InputStream is, String resourceName) Description copied from interface:ValidatorFileParser
Parses validator definitions (register various validators with XWork).- Specified by:
parseValidatorDefinitions
in interfaceValidatorFileParser
- Parameters:
validators
- map of validatorsis
- The input streamresourceName
- The location of the input stream
-
getTextValue
Extract trimmed text value from the given DOM element, ignoring XML comments. Appends all CharacterData nodes and EntityReference nodes into a single String value, excluding Comment nodes. This method is based on a method originally found in DomUtils class of Springframework.- Parameters:
valueEle
- the given DOM element- Returns:
- the text value
- See Also:
-