Skip to content

XSD Boolean

Understand how to use the boolean data type (<xs:boolean>) in XML Schema Definition (XSD) with valid values like true, false, 1, and 0 and its supported restrictions.

Boolean data type is used to specify a true or false value.

Boolean Data Type

The boolean data type (<xs:boolean>) is used to represent boolean values (true or false).

Let's see an example:

<xs:attribute name="disabled" type="xs:boolean"/>

and an element in your XML document look like this:

<price disabled="true">999</price>

Restrictions on Boolean Data Type

Restrictions that can be used with Boolean data type:

  • pattern
  • whiteSpace

See XSD Restrictions chapter to learn more.

Navigation