Entering content frameFunction documentation Facets Locate the document in its SAP Library structure

Use

Facets enable you to restrict the value range of a data type in XML schema to a particular subset. This enables you to determine exactly which value is expected in a special case for a simple data type, an element, or an attribute. For example:

Prerequisites

Before you can use a facet, you must have selected a built-in data type in the Type column for your simple data type, element, or attribute. Otherwise the input field in the Details column remains locked.

Features

Using the XSD editor, you can further restrict the value range of a built-in data type for simple data types, elements or attributes.

Input Options in the Details Column

Facet

Meaning

enumeration

Restrict the value range to a set of individual values. The values must be separated by blanks in the XSD editor.

fractionDigits

Specify the number of places permitted after the comma. Only xsd:nonNegativeInteger type values are valid.

length,
maxLength,
minLength

Exact (length), maximum (maxLength), or minimum (minLength) length of a data type. The XSD editor only permits these facets for data types that are based on xsd:string. The value of this facet must be of type xsd:nonNegativeInteger.

maxExclusive,
maxInclusive

Upper limit for the value set exclusive (maxExclusive) or inclusive (maxInclusive) of the specified value. The value of this facet must not exceed the value range of the data type that is restricted by the facet.

minExclusive,
minInclusive

Lower limit for the value set exclusive (minExclusive) or inclusive (minInclusive) of the specified value. The value of this facet must not exceed the value range of the data type that is restricted by the facet.

pattern

Specify a pattern for string-based data types. The pattern must have the form of a regular expression that describes a set of appropriate character sequences.

totalDigits

Specifies the total number of digits in a number. Only xsd:positiveInteger type values are valid.

whiteSpace

Specifies how to apply white space characters (line feed, tabs, blanks, and carriage returns). Three values are permitted:

  • preserve: Retain all white space characters.
  • replace: Replace every line feed, tab, and carriage return with a blank.
  • collapse: As for replace but subsequent blanks are replaced by a single blank and leading and final blanks are deleted.

Note

Also see: http://www.w3.org/TR/xmlschema-2/#rf-facets

Regular Expressions in XML Schema

Regular expressions originate from the Unix world and are expressions that you can use to describe any type of string. Regular expressions for XML schema are defined under http://www.w3.org/TR/xmlschema-2/#regexs. Instead of completely repeating this definition, here are a few common examples of how regular expressions are used:

Example Pattern

Regular Expression

Appropriate Strings (Separated by Commas and Blanks)

[abcdefg]

a, b, c, d, e, f, g

[A-Z][A-Z][A-Z]

ABC, DEF, SAP, SPD, CDU, FDP, PDS

[0-9][0-9][0-9]

007, 459, 471, 999, 879

[a-z]([0-9])*

a, b, c, d, e, i12784937, e3321, t4000, b345

[a-z]([0-9])+

a304, i20, e3012, t5, b90000

([a-z]|[0-9])+

a, ab, abc, abcdefg, 0, 1, 01, 012, 0123

For star (*), the character may not occur at all in the string, or it can occur an unlimited number of times. For plus (+), the character must occur at least once in the string. The square brackets specify the character selection.

Note

Also see: http://www.w3schools.com/schema/schema_facets.asp

Additionally, there are also special characters that can be introduced with a backslash, for example:

 

 

 

 

Leaving content frame