Model Validation Strategies
| Default Strategies for Model Validation |
| Type | JAR |
| Category | API |
| Developed by | |
| Rating | |
| License | GNU Lesser General Public License 2.1 |
| Bundled With | XWiki Standard |
| Compatibility | Since XWiki 12.0RC1 |
Table of contents
Description
Existing Strategies
Several Validation strategies are available by default and can be configured in the Admin UI.
Character Replacement Strategy
This strategy allows you to define characters that are forbidden in a page name, and how to replace them. For each forbidden character you define, you can specify a specific replacement character. Or you can chose to not specify a replacement character and in that case, forbidden cases will be just removed.
This strategy is selected by default, with / (slash) and \ (backslash) as forbidden characters, without replacements defined for them.
Kebab-case Strategy
XWiki 18.1.0+

This strategy will normalize your page names by removing special characters, as follows:
- Only the latin alphabet (26 letters) without accents, the numbers and the character - (dash) are accepted.
- The accents are automatically transformed to the closest latin letter,
- All other special characters are transformed to dashes
- Redundant dashes are removed
- XWiki 18.1.0+ (optional) Convert letters to lowercase
- XWiki 18.1.0+ (optional) Allow dots when used between digits (to represent versions or numbers)
- XWiki 18.1.0+ (optional) Remove configured forbidden words (e.g. stop words)
As an example, here's a list of English stop words that can be configured to be removed. The following stop words are excluded as they also have meanings in English when special characters are removed:
- "id" (for "i'd") is excluded since it could be the shortcut of identificator.
- "hell" (for "he'll")
- "ill" (for "i'll")
- "shed" (for "she'd")
- "shell" (for "she'll")
- "well" (for "we'll")
a,about,above,after,again,against,all,am,an,and,any,are,arent,as,at,be,because,been,before,being,below,between,both,but,by,cant,cannot,could,couldnt,did,didnt,do,does,doesnt,doing,dont,down,during,each,few,for,from,further,had,hadnt,has,hasnt,have,havent,having,he,hed,hes,her,here,heres,hers,herself,him,himself,his,how,hows,i,im,ive,if,in,into,is,isnt,it,its,its,itself,lets,me,more,most,mustnt,my,myself,no,nor,not,of,off,on,once,only,or,other,ought,our,ours,ourselves,out,over,own,same,shant,she,shes,should,shouldnt,so,some,such,than,that,thats,the,their,theirs,them,themselves,then,there,theres,these,they,theyd,theyll,theyre,theyve,this,those,through,to,too,under,until,up,very,was,wasnt,we,wed,were,weve,were,werent,what,whats,when,whens,where,wheres,which,while,who,whos,whom,why,whys,with,wont,would,wouldnt,you,youd,youll,youre,youve,your,yours,yourself,yourselves
Name Strategy Script Service
A script service is available to use name strategy components. It can be accessed with $services.modelvalidation.
You can check the API directly on the source.
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
Dependencies
Dependencies for this extension (org.xwiki.platform:xwiki-platform-model-validation-default 18.4.1):
- org.xwiki.platform:xwiki-platform-model-validation-api 18.4.1
- org.xwiki.platform:xwiki-platform-configuration-default 18.4.1