Skip to main content

XSD Boolean

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>
note

Legal values for boolean are true, false, 1 (which indicates true) and 0 (which indicates false).

Restrictions on Boolean Data Type

Restrictions that can be used with Boolean data type:

  • pattern
  • whiteSpace

See XSD Restrictions chapter to learn more.