</>
Skip to content
XML lessons (27/29)

XML — Schema Reference

Data Types

TypeDescriptionExample
xs:stringText"Hello"
xs:integerWhole number42
xs:decimalDecimal number3.14
xs:booleanTrue/falsetrue
xs:dateDate2025-01-01
xs:dateTimeDate+time2025-01-01T12:00:00
xs:timeTime12:00:00
xs:durationDurationP1Y2M
xs:anyURIURLhttps://example.com

Restrictions

RestrictionDescription
minInclusiveMinimum value (inclusive)
maxInclusiveMaximum value (inclusive)
minExclusiveMinimum value (exclusive)
maxExclusiveMaximum value (exclusive)
minLengthMinimum length
maxLengthMaximum length
lengthExact length
patternRegex pattern
enumerationList of values

Complex Types

<xs:complexType name="PersonType">
    <xs:sequence>
        <xs:element name="name" type="xs:string"/>
        <xs:element name="age" type="xs:integer"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:integer"/>
</xs:complexType>

Occurrence Indicators

IndicatorDescription
minOccursMinimum occurrences
maxOccursMaximum occurrences

Mini Practice

  1. Use different data types
  2. Add restrictions
  3. Create complex types
  4. Set occurrence indicators

Up Next

Continue with XPath Reference — XPath expression reference.

Related Topics

Frequently Asked Questions about Schema Reference

What is Schema Reference in XML?

Schema Reference is a fundamental concept in XML. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Schema Reference?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Schema Reference.

Why is Schema Reference important in XML?

Schema Reference is essential for XML development. Understanding this concept will help you write better code and solve real-world problems more effectively.