0
votes

Given the following element:

  <xsd:element name="abr">
    <xsd:annotation>
      <xsd:documentation>Abbreviaturen</xsd:documentation>
    </xsd:annotation>
    <xsd:complexType mixed="true">
      <xsd:choice maxOccurs="unbounded" minOccurs="0">
        <xsd:element ref="maj"/>
        <xsd:element ref="sup"/>
        <xsd:element ref="lin"/>
        <xsd:element ref="cap"/>
        <xsd:element ref="cif"/>
      </xsd:choice>
    </xsd:complexType>
  </xsd:element>

I want to add the following restriction to the tag <abr> content (deny spaces):

  <xsd:restriction base="xsd:string">
    <xsd:pattern value="[^\r\n\t ]*"/>
  </xsd:restriction>

How can I define this restriction in order to be valid ?

1

1 Answers

0
votes

The element has a mixed content model (allowing child elements as well as text). There is no mechanism in XSD 1.0 to restrict what can appear in the text nodes within an element with mixed content. You can do it in XSD 1.1 with assertions.