Search code examples
xmlxsdrestriction

XSD. How to make restriction to capitalize the first letter of a word


I am trying to restrict my xml to forbid a certain word because the first letter is not capital ? For example,a name field. A name cannot start with a small letter.


Solution

  • Use an xs:pattern facet with a value such as \p{Lu}.*.

    If this is for personal names, do be aware that there are people named "ffinch" who will get very upset if you capitalise their names incorrectly.