Skip to main content
Tweeted twitter.com/StackTridion/status/928112317606301696
[Edit removed during grace period]
Source Link
John Bax
  • 345
  • 2
  • 9
edited tags
Link
Nuno Linhares
  • 29.1k
  • 3
  • 42
  • 91
Source Link
John Bax
  • 345
  • 2
  • 9

How to add field constraints to a Schema

In the documentation I read that it is possible to constrain field content of single-line text fields, number fields and date fields. But how exactly do I do that?

My (simplified) Schema looks like this:

<xsd:schema xmlns="uuid:2b" xmlns:tcmi="http://www.tridion.com/ContentManager/5.0/Instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="uuid:2b">
  <xsd:import namespace="http://www.tridion.com/ContentManager/5.0/Instance"></xsd:import>
  <xsd:annotation>
    <xsd:appinfo>
      <tcm:Labels xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
        <tcm:Label ElementName="tag" Metadata="false">Tag</tcm:Label>
      </tcm:Labels>
    </xsd:appinfo>
  </xsd:annotation>
  <xsd:element name="Content">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="tag" minOccurs="1" maxOccurs="unbounded" type="xsd:normalizedString">
          <xsd:annotation>
            <xsd:appinfo>
              <tcm:ExtensionXml xmlns:tcm="http://www.tridion.com/ContentManager/5.0"></tcm:ExtensionXml>
            </xsd:appinfo>
          </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>

So how would I set a maximum length of 15 characters on the tag field?