Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : XML : Education - Tutorials
XML Schema Infoset Model, Part 2
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPreviousNext
3. Simple types
  


Schema component constraints page 3 of 10


XML Schema provides a mechanism of constraining a given simple element or simple attribute, which are known as facets or value constraints. Here is a list of the facets provided by XML Schema:

<enumeration>
Defines a list of acceptable values.
Enumeration facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#dc-enumeration.
The XML Schema model java interface for a <enumeration> is org.eclipse.xsd.XSDEnumerationFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDEnumerationFacet().

<fractionDigits>
Specifies the maximum number of decimal places allowed. Must be equal to or greater than zero.
FractionDigit facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#dt-fractionDigits.
The XML Schema model java interface for a <enumeration> is org.eclipse.xsd.XSDFractionDigitsFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDFractionDigitsFacet().

<length>
Specifies the exact number of characters or list items allowed. Must be equal to or greater than zero.
Length facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#dt-length.
The XML Schema model java interface for a <length> is org.eclipse.xsd.XSDLengthFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDLengthFacet().

<maxExclusive>
Specifies the upper bounds for numeric values (the value must be less than this value).
MaxExclusive facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-maxExclusive.
The XML Schema model java interface for a <maxExclusive> is org.eclipse.xsd.XSDMaxExclusiveFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDMaxExclusiveFacet().

<maxInclusive>
Specifies the upper bounds for numeric values (the value must be less than or equal to this value).
MaxInclusive facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-maxInclusive.
The XML Schema model java interface for a <maxInclusive> is org.eclipse.xsd.XSDMaxInclusiveFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDMaxInclusiveFacet().

<maxLength>
Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero.
MaxLength facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-maxLength.
The XML Schema model java interface for a <maxLength> is org.eclipse.xsd.XSDMaxLengthFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDLengthFacet().

<minExclusive>
Specifies the lower bounds for numeric values (the value must be greater than this value).
MinExclusive facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-minExclusive.
The XML Schema model java interface for a <minExclusive> is org.eclipse.xsd.XSDMinExclusiveFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDMinExclusiveFacet().

<minInclusive>
Specifies the lower bounds for numeric values (the value must be greater than or equal to this value).
MinInclusive facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-minInclusive.
The XML Schema model java interface for a <minInclusive> is org.eclipse.xsd.XSDMinInclusiveFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDMinInclusiveFacet().

<minLength>
Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero.
MinLength facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-minLength.
The XML Schema model java interface for a <minLength> is org.eclipse.xsd.XSDMinLengthFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDMinLengthFacet().

<pattern>
Defines the exact sequence of characters that are acceptable.
Pattern facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-pattern.
The XML Schema model java interface for a <pattern> is org.eclipse.xsd.XSDPatternFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDPatternFacet().

<totalDigits>
Specifies the exact number of digits allowed. Must be greater than zero.
TotalDigits facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-totalDigits.
The XML Schema model java interface for a <totalDigits> is org.eclipse.xsd.XSDTotalDigitsFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDTotalDigitsFacet().

<whiteSpace>
Specifies how white space (line feeds, tabs, spaces, and carriage returns) are handled.
WhiteSpace facets contain some attributes, which are described by http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace.
The XML Schema model java interface for a <whiteSpace> is org.eclipse.xsd.XSDWhiteSpaceFacet and can be created by calling org.eclipse.xsd.XSDFactory.eINSTANCE.createXSDWhiteSpaceFacet().

Constraints on simple type definition Schema components
The constraining facets which are allowed to be members of facets are dependent on base type definition as specified in the following table:
http://www.w3.org/TR/xmlschema-2/#cos-applicable-facets.


Main menuSection menuFeedbackPreviousNext
About IBM | Privacy | Legal | Contact