I am using SDL WEB 8.1.

I am trying to add the schema field restriction to Text type field. Restriction of field is minimum and maximum 12 characters.

I have an idea to implement using GUI extension but the requirement via xsd change in schema.

I have followed the below links information but not able to achieve, could you please help me out.

  1. How to add field constraints to a Schema
  2. http://nunolinhares.blogspot.co.uk/2012/07/validating-content-on-save-part-1-of.html

Taken from comments

 <xsd:schema xmlns:xsd="w3.org/2001/XMLSchema"; xmlns="uuid:7176e2ea-b262-458d-a692-87947328b203" xmlns:tcmi="tridion.com/ContentManager/5.0/Instance"; elementFormDefault="qualified" targetNamespace="uuid:7176e2ea-b262-458d-a692-87947328b203"> <xsd:import namespace="tridion.com/ContentManager/5.0/Instance"; schemaLocation="cm_xml_inst.xsd"></xsd:import> <xsd:annotation> <xsd:appinfo> <tcm:Labels xmlns:tcm="tridion.com/ContentManager/5.0">; <tcm:Label ElementName="txtAlpha" Metadata="false">Enter the text</tcm:Label> </tcm:Labels> </xsd:appinfo> </xsd:annotation> <xsd:element name="txtEmailContent"> <xsd:complexType> <xsd:sequence> <xsd:element name="txtAlpha" minOccurs="0" maxOccurs="1" type="xsd:normalizedString"> <xsd:annotation> <xsd:appinfo> <tcm:ExtensionXml xmlns:tcm="tridion.com/ContentManager/5.0"></…; </xsd:appinfo> </xsd:annotation> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element>
<xsd:simpleType name="datatypeString"> <xsd:annotation> <xsd:documentation> Alpha Numeric field of length 4-10 characters</xsd:documentation> </xsd:annotation> <xsd:restriction base="xsd:normalizedString"> <xsd:minLength value="4"></xsd:minLength> <xsd:maxLength value="10"></xsd:maxLength> </xsd:restriction> </xsd:simpleType> </xsd:schema>
  • 1
    When you state you've "followed the below links information but not able to achieve" it would be helpful to allow someone to cast an eye over the exact syntax (sometime an extra space, missing semi-colon is easily missed) - can you paste you (non-working) example here; confirming if this is a standard schema/embeddable schema etc. - the more info you can pass the better equipped we are to help... Sep 26, 2017 at 8:59
  • The XML you've added is not valid (see second AppInfo field element). Please update in the question Sep 26, 2017 at 10:03
  • Hi Mark, That I haven't edited while added a text filed to the normal schema the source is generated.
    – Sree G
    Sep 26, 2017 at 10:06
  • Hi Mark, In the comment, it is misplaced but in my schema source as expected <xsd:appinfo> <tcm:ExtensionXml xmlns:tcm="tridion.com/ContentManager/5.0"></tcm:ExtensionXml> </xsd:appinfo>
    – Sree G
    Sep 26, 2017 at 10:08

1 Answer 1


It's not useful to try and review your XML (schema definition) in comments - next time please do put the full XML in the question directly (and then format as code so it's readable).

Also, it's more useful to include the exact error you have (in your case I suspect you can't even save the schema due to the duplicate type)

Working through what I can there are two possible issues

  1. You have left type="xsd:normalizedString" in the element for txtAlpha - as the page you quote states, this needs to be updated and moved into the restriction element (where you have added it).

  2. Furthermore, I've encountered an issue in the past (with 2013 SP1) where the the base="xsd:normalisedString" had to be changed to base="xsd:string" to allow be to save. On reloading the schema returns (and can be resaved) with normalizedString as expected.

This has just worked in my test env.

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="uuid:5b5bea2f-1f88-43b3-8a35-e0d3f248a1d3" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" elementFormDefault="qualified" targetNamespace="uuid:5b5bea2f-1f88-43b3-8a35-e0d3f248a1d3">
  <xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance" schemaLocation="cm_xml_inst.xsd"></xsd:import>
      <tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
        <tcm:Label ElementName="txtAlpha" Metadata="false">Enter the text (min 4 characters and max 12 characters)</tcm:Label>
  <xsd:element name="txtEmailContent">
        <xsd:element name="txtAlpha" minOccurs="1" maxOccurs="1">
              <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0"></tcm:ExtensionXml>
            <xsd:restriction base="xsd:normalizedString">
              <xsd:minLength value="4"></xsd:minLength>
              <xsd:maxLength value="12"></xsd:maxLength>
  • Hi Mark, thanks a lot for your support, much appreciated. Sorry for my mistakes in the comment post i have added glitch code. I will follow the guidelines which u have provided for further queries. And simpletype i have declared in within xsd: sequence path so that time I have saved the schema without any errors. And last question if I have multiple restrictions on single normalizedString type is it possible to implement. Let's say it should validate the web url and email pattern.
    – Sree G
    Sep 27, 2017 at 1:00
  • 1
    No worries Sreekanth - this is a great resource for us Trinionaughts and the simple thing to remember is to make it simple for others to help you - usually by letting them know the context of the question, examples and the things you've tried - et voila - help will be forthcoming!!! on having multiple evaluations you can see this is already shown in the example above; under the xsd:restriction node you simple add constraints one after the other - just be sure they don't conflict ;) Sep 28, 2017 at 7:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.