org.apache.xerces.impl.dv.xs

Class XSSimpleTypeDecl

Implemented Interfaces:
org.w3c.dom.TypeInfo, org.apache.xerces.xs.XSObject, XSSimpleType, org.apache.xerces.xs.XSSimpleTypeDefinition, org.apache.xerces.xs.XSTypeDefinition

public class XSSimpleTypeDecl
extends java.lang.Object
implements XSSimpleType, org.w3c.dom.TypeInfo

Version:
$Id: XSSimpleTypeDecl.java 396205 2006-04-23 02:46:42Z mrglavas $
Authors:
Sandy Gao, IBM
Neeraj Bajaj, Sun Microsystems, inc.

Field Summary

static short
ANYATOMICTYPE_DT
static short
DAYTIMEDURATION_DT
static short
PRECISIONDECIMAL_DT
static short
YEARMONTHDURATION_DT
org.apache.xerces.xs.XSObjectList
enumerationAnnotations
org.apache.xerces.xs.XSAnnotation
fractionDigitsAnnotation
org.apache.xerces.xs.XSAnnotation
lengthAnnotation
org.apache.xerces.xs.XSAnnotation
maxExclusiveAnnotation
org.apache.xerces.xs.XSAnnotation
maxInclusiveAnnotation
org.apache.xerces.xs.XSAnnotation
maxLengthAnnotation
org.apache.xerces.xs.XSAnnotation
minExclusiveAnnotation
org.apache.xerces.xs.XSAnnotation
minInclusiveAnnotation
org.apache.xerces.xs.XSAnnotation
minLengthAnnotation
XSObjectListImpl
patternAnnotations
org.apache.xerces.xs.XSAnnotation
totalDigitsAnnotation
org.apache.xerces.xs.XSAnnotation
whiteSpaceAnnotation

Fields inherited from interface org.w3c.dom.TypeInfo

DERIVATION_EXTENSION, DERIVATION_LIST, DERIVATION_RESTRICTION, DERIVATION_UNION

Fields inherited from interface org.apache.xerces.impl.dv.XSSimpleType

PRIMITIVE_ANYURI, PRIMITIVE_BASE64BINARY, PRIMITIVE_BOOLEAN, PRIMITIVE_DATE, PRIMITIVE_DATETIME, PRIMITIVE_DECIMAL, PRIMITIVE_DOUBLE, PRIMITIVE_DURATION, PRIMITIVE_FLOAT, PRIMITIVE_GDAY, PRIMITIVE_GMONTH, PRIMITIVE_GMONTHDAY, PRIMITIVE_GYEAR, PRIMITIVE_GYEARMONTH, PRIMITIVE_HEXBINARY, PRIMITIVE_NOTATION, PRIMITIVE_PRECISIONDECIMAL, PRIMITIVE_QNAME, PRIMITIVE_STRING, PRIMITIVE_TIME, WS_COLLAPSE, WS_PRESERVE, WS_REPLACE

Fields inherited from interface org.apache.xerces.xs.XSSimpleTypeDefinition

FACET_ENUMERATION, FACET_FRACTIONDIGITS, FACET_LENGTH, FACET_MAXEXCLUSIVE, FACET_MAXINCLUSIVE, FACET_MAXLENGTH, FACET_MINEXCLUSIVE, FACET_MININCLUSIVE, FACET_MINLENGTH, FACET_NONE, FACET_PATTERN, FACET_TOTALDIGITS, FACET_WHITESPACE, ORDERED_FALSE, ORDERED_PARTIAL, ORDERED_TOTAL, VARIETY_ABSENT, VARIETY_ATOMIC, VARIETY_LIST, VARIETY_UNION

Fields inherited from interface org.apache.xerces.xs.XSTypeDefinition

COMPLEX_TYPE, SIMPLE_TYPE

Constructor Summary

XSSimpleTypeDecl()
XSSimpleTypeDecl(String name, String uri, short finalSet, XSSimpleTypeDecl itemType, boolean isImmutable, org.apache.xerces.xs.XSObjectList annotations)
XSSimpleTypeDecl(String name, String uri, short finalSet, XSSimpleTypeDecl[] memberTypes, org.apache.xerces.xs.XSObjectList annotations)
XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, String uri, short finalSet, boolean isImmutable, org.apache.xerces.xs.XSObjectList annotations)
XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, String uri, short finalSet, boolean isImmutable, org.apache.xerces.xs.XSObjectList annotations, short builtInKind)
XSSimpleTypeDecl(XSSimpleTypeDecl base, String name, short validateDV, short ordered, boolean bounded, boolean finite, boolean numeric, boolean isImmutable, short builtInKind)

Method Summary

void
applyFacets(XSFacets facets, short presentFacet, short fixedFacet, ValidationContext context)
If is chosen
boolean
derivedFrom(String ancestorNS, String ancestorName, short derivation)
boolean
derivedFromType(org.apache.xerces.xs.XSTypeDefinition ancestor, short derivation)
org.apache.xerces.xs.datatypes.ObjectList
getActualEnumeration()
A list of actual enumeration values if it exists, otherwise an empty ObjectList.
org.apache.xerces.xs.XSObjectList
getAnnotations()
[annotations]: a set of annotations for this simple type component if it exists, otherwise an empty XSObjectList.
boolean
getAnonymous()
org.apache.xerces.xs.XSTypeDefinition
getBaseType()
boolean
getBounded()
Fundamental Facet: bounded.
short
getBuiltInKind()
Returns the closest built-in type category this type represents or derived from.
short
getDefinedFacets()
[facets]: all facets defined on this type.
org.apache.xerces.xs.datatypes.ObjectList
getEnumerationItemTypeList()
A list of enumeration type values (as a list of ShortList objects) if it exists, otherwise returns null
org.apache.xerces.xs.ShortList
getEnumerationTypeList()
org.apache.xerces.xs.XSObjectList
getFacets()
A list of constraining facets if it exists, otherwise an empty XSObjectList.
short
getFinal()
boolean
getFinite()
Fundamental Facet: cardinality.
short
getFixedFacets()
[facets]: all defined facets for this type which are fixed.
org.apache.xerces.xs.XSSimpleTypeDefinition
getItemType()
If variety is list the item type definition (an atomic or union simple type definition) is available, otherwise null.
org.apache.xerces.xs.StringList
getLexicalEnumeration()
A list of enumeration values if it exists, otherwise an empty StringList.
String
getLexicalFacetValue(short facetName)
Convenience method.
org.apache.xerces.xs.StringList
getLexicalPattern()
A list of pattern values if it exists, otherwise an empty StringList.
Object
getMaxExclusiveValue()
Object
getMaxInclusiveValue()
org.apache.xerces.xs.XSObjectList
getMemberTypes()
If variety is union the list of member type definitions (a non-empty sequence of simple type definitions) is available, otherwise an empty XSObjectList.
Object
getMinExclusiveValue()
Object
getMinInclusiveValue()
org.apache.xerces.xs.XSObjectList
getMultiValueFacets()
A list of enumeration and pattern constraining facets if it exists, otherwise an empty XSObjectList.
String
getName()
String
getNamespace()
org.apache.xerces.xs.XSNamespaceItem
getNamespaceItem()
boolean
getNumeric()
Fundamental Facet: numeric.
short
getOrdered()
Fundamental Facet: ordered.
short
getPrimitiveKind()
return an ID representing the built-in primitive base type.
org.apache.xerces.xs.XSSimpleTypeDefinition
getPrimitiveType()
If variety is atomic the primitive type definition (a built-in primitive datatype definition or the simple ur-type definition) is available, otherwise null.
short
getType()
short
getTypeCategory()
String
getTypeName()
String
getTypeNamespace()
short
getVariety()
short
getWhitespace()
Return the whitespace corresponding to this datatype.
boolean
isDOMDerivedFrom(String ancestorNS, String ancestorName, int derivationMethod)
Checks if a type is derived from another by restriction, given the name and namespace.
boolean
isDefinedFacet(short facetName)
Convenience method.
boolean
isDerivedFrom(String typeNamespaceArg, String typeNameArg, int derivationMethod)
boolean
isEqual(Object value1, Object value2)
Check whether two actual values are equal.
boolean
isFinal(short derivation)
boolean
isFixedFacet(short facetName)
Convenience method.
boolean
isIDType()
Check whether this type is or is derived from ID.
boolean
isIdentical(Object value1, Object value2)
protected String
normalize(Object content, short ws)
static String
normalize(String content, short ws)
void
reset()
void
setAnonymous(boolean anon)
protected XSSimpleTypeDecl
setListValues(String name, String uri, short finalSet, XSSimpleTypeDecl itemType, org.apache.xerces.xs.XSObjectList annotations)
protected XSSimpleTypeDecl
setRestrictionValues(XSSimpleTypeDecl base, String name, String uri, short finalSet, org.apache.xerces.xs.XSObjectList annotations)
protected XSSimpleTypeDecl
setUnionValues(String name, String uri, short finalSet, XSSimpleTypeDecl[] memberTypes, org.apache.xerces.xs.XSObjectList annotations)
String
toString()
Object
validate(Object content, ValidationContext context, ValidatedInfo validatedInfo)
validate a value, and return the compiled form
Object
validate(String content, ValidationContext context, ValidatedInfo validatedInfo)
validate a value, and return the compiled form
void
validate(ValidationContext context, ValidatedInfo validatedInfo)
validate an actual value against this DV
ValidatedInfo
validateWithInfo(String content, ValidationContext context, ValidatedInfo validatedInfo)
validate a value, and return the compiled form

Field Details

ANYATOMICTYPE_DT

public static final short ANYATOMICTYPE_DT
Field Value:
49

DAYTIMEDURATION_DT

public static final short DAYTIMEDURATION_DT
Field Value:
47

PRECISIONDECIMAL_DT

public static final short PRECISIONDECIMAL_DT
Field Value:
48

YEARMONTHDURATION_DT

public static final short YEARMONTHDURATION_DT
Field Value:
46

enumerationAnnotations

public org.apache.xerces.xs.XSObjectList enumerationAnnotations

fractionDigitsAnnotation

public org.apache.xerces.xs.XSAnnotation fractionDigitsAnnotation

lengthAnnotation

public org.apache.xerces.xs.XSAnnotation lengthAnnotation

maxExclusiveAnnotation

public org.apache.xerces.xs.XSAnnotation maxExclusiveAnnotation

maxInclusiveAnnotation

public org.apache.xerces.xs.XSAnnotation maxInclusiveAnnotation

maxLengthAnnotation

public org.apache.xerces.xs.XSAnnotation maxLengthAnnotation

minExclusiveAnnotation

public org.apache.xerces.xs.XSAnnotation minExclusiveAnnotation

minInclusiveAnnotation

public org.apache.xerces.xs.XSAnnotation minInclusiveAnnotation

minLengthAnnotation

public org.apache.xerces.xs.XSAnnotation minLengthAnnotation

patternAnnotations

public XSObjectListImpl patternAnnotations

totalDigitsAnnotation

public org.apache.xerces.xs.XSAnnotation totalDigitsAnnotation

whiteSpaceAnnotation

public org.apache.xerces.xs.XSAnnotation whiteSpaceAnnotation

Constructor Details

XSSimpleTypeDecl

public XSSimpleTypeDecl()

XSSimpleTypeDecl

protected XSSimpleTypeDecl(String name,
                           String uri,
                           short finalSet,
                           XSSimpleTypeDecl itemType,
                           boolean isImmutable,
                           org.apache.xerces.xs.XSObjectList annotations)

XSSimpleTypeDecl

protected XSSimpleTypeDecl(String name,
                           String uri,
                           short finalSet,
                           XSSimpleTypeDecl[] memberTypes,
                           org.apache.xerces.xs.XSObjectList annotations)

XSSimpleTypeDecl

protected XSSimpleTypeDecl(XSSimpleTypeDecl base,
                           String name,
                           String uri,
                           short finalSet,
                           boolean isImmutable,
                           org.apache.xerces.xs.XSObjectList annotations)

XSSimpleTypeDecl

protected XSSimpleTypeDecl(XSSimpleTypeDecl base,
                           String name,
                           String uri,
                           short finalSet,
                           boolean isImmutable,
                           org.apache.xerces.xs.XSObjectList annotations,
                           short builtInKind)

XSSimpleTypeDecl

protected XSSimpleTypeDecl(XSSimpleTypeDecl base,
                           String name,
                           short validateDV,
                           short ordered,
                           boolean bounded,
                           boolean finite,
                           boolean numeric,
                           boolean isImmutable,
                           short builtInKind)

Method Details

applyFacets

public void applyFacets(XSFacets facets,
                        short presentFacet,
                        short fixedFacet,
                        ValidationContext context)
            throws InvalidDatatypeFacetException
If is chosen
Specified by:
applyFacets in interface XSSimpleType

derivedFrom

public boolean derivedFrom(String ancestorNS,
                           String ancestorName,
                           short derivation)
Specified by:
derivedFrom in interface org.apache.xerces.xs.XSTypeDefinition

derivedFromType

public boolean derivedFromType(org.apache.xerces.xs.XSTypeDefinition ancestor,
                               short derivation)
Specified by:
derivedFromType in interface org.apache.xerces.xs.XSTypeDefinition

getActualEnumeration

public org.apache.xerces.xs.datatypes.ObjectList getActualEnumeration()
A list of actual enumeration values if it exists, otherwise an empty ObjectList.

getAnnotations

public org.apache.xerces.xs.XSObjectList getAnnotations()
[annotations]: a set of annotations for this simple type component if it exists, otherwise an empty XSObjectList.
Specified by:
getAnnotations in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getAnonymous

public boolean getAnonymous()
Specified by:
getAnonymous in interface org.apache.xerces.xs.XSTypeDefinition

getBaseType

public org.apache.xerces.xs.XSTypeDefinition getBaseType()
Specified by:
getBaseType in interface org.apache.xerces.xs.XSTypeDefinition

getBounded

public boolean getBounded()
Fundamental Facet: bounded.
Specified by:
getBounded in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getBuiltInKind

public short getBuiltInKind()
Returns the closest built-in type category this type represents or derived from. For example, if this simple type is a built-in derived type integer the INTEGER_DV is returned.
Specified by:
getBuiltInKind in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getDefinedFacets

public short getDefinedFacets()
[facets]: all facets defined on this type. The value is a bit combination of FACET_XXX constants of all defined facets.
Specified by:
getDefinedFacets in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getEnumerationItemTypeList

public org.apache.xerces.xs.datatypes.ObjectList getEnumerationItemTypeList()
A list of enumeration type values (as a list of ShortList objects) if it exists, otherwise returns null

getEnumerationTypeList

public org.apache.xerces.xs.ShortList getEnumerationTypeList()

getFacets

public org.apache.xerces.xs.XSObjectList getFacets()
A list of constraining facets if it exists, otherwise an empty XSObjectList. Note: This method must not be used to retrieve values for enumeration and pattern facets.
Specified by:
getFacets in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getFinal

public short getFinal()
Specified by:
getFinal in interface org.apache.xerces.xs.XSTypeDefinition

getFinite

public boolean getFinite()
Fundamental Facet: cardinality.
Specified by:
getFinite in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getFixedFacets

public short getFixedFacets()
[facets]: all defined facets for this type which are fixed.
Specified by:
getFixedFacets in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getItemType

public org.apache.xerces.xs.XSSimpleTypeDefinition getItemType()
If variety is list the item type definition (an atomic or union simple type definition) is available, otherwise null.
Specified by:
getItemType in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getLexicalEnumeration

public org.apache.xerces.xs.StringList getLexicalEnumeration()
A list of enumeration values if it exists, otherwise an empty StringList.
Specified by:
getLexicalEnumeration in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getLexicalFacetValue

public String getLexicalFacetValue(short facetName)
Convenience method. Returns a value of a single constraining facet for this simple type definition. This method must not be used to retrieve values for enumeration and pattern facets.
Specified by:
getLexicalFacetValue in interface org.apache.xerces.xs.XSSimpleTypeDefinition
Parameters:
facetName - The name of the facet, i.e. FACET_LENGTH, FACET_TOTALDIGITS (see XSConstants). To retrieve the value for a pattern or an enumeration, see enumeration and pattern.
Returns:
A value of the facet specified in facetName for this simple type definition or null.

getLexicalPattern

public org.apache.xerces.xs.StringList getLexicalPattern()
A list of pattern values if it exists, otherwise an empty StringList.
Specified by:
getLexicalPattern in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getMaxExclusiveValue

public Object getMaxExclusiveValue()

getMaxInclusiveValue

public Object getMaxInclusiveValue()

getMemberTypes

public org.apache.xerces.xs.XSObjectList getMemberTypes()
If variety is union the list of member type definitions (a non-empty sequence of simple type definitions) is available, otherwise an empty XSObjectList.
Specified by:
getMemberTypes in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getMinExclusiveValue

public Object getMinExclusiveValue()

getMinInclusiveValue

public Object getMinInclusiveValue()

getMultiValueFacets

public org.apache.xerces.xs.XSObjectList getMultiValueFacets()
A list of enumeration and pattern constraining facets if it exists, otherwise an empty XSObjectList.
Specified by:
getMultiValueFacets in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getName

public String getName()
Specified by:
getName in interface org.apache.xerces.xs.XSObject

getNamespace

public String getNamespace()
Specified by:
getNamespace in interface org.apache.xerces.xs.XSObject

getNamespaceItem

public org.apache.xerces.xs.XSNamespaceItem getNamespaceItem()
Specified by:
getNamespaceItem in interface org.apache.xerces.xs.XSObject
See Also:
org.apache.xerces.xs.XSObject.getNamespaceItem()

getNumeric

public boolean getNumeric()
Fundamental Facet: numeric.
Specified by:
getNumeric in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getOrdered

public short getOrdered()
Fundamental Facet: ordered.
Specified by:
getOrdered in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getPrimitiveKind

public short getPrimitiveKind()
return an ID representing the built-in primitive base type. REVISIT: This method is (currently) for internal use only. the constants returned from this method are not finalized yet. the names and values might change in the further.
Specified by:
getPrimitiveKind in interface XSSimpleType
Returns:
an ID representing the built-in primitive base type

getPrimitiveType

public org.apache.xerces.xs.XSSimpleTypeDefinition getPrimitiveType()
If variety is atomic the primitive type definition (a built-in primitive datatype definition or the simple ur-type definition) is available, otherwise null.
Specified by:
getPrimitiveType in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getType

public short getType()
Specified by:
getType in interface org.apache.xerces.xs.XSObject

getTypeCategory

public short getTypeCategory()
Specified by:
getTypeCategory in interface org.apache.xerces.xs.XSTypeDefinition

getTypeName

public String getTypeName()
Specified by:
getTypeName in interface org.w3c.dom.TypeInfo

getTypeNamespace

public String getTypeNamespace()
Specified by:
getTypeNamespace in interface org.w3c.dom.TypeInfo

getVariety

public short getVariety()
Specified by:
getVariety in interface org.apache.xerces.xs.XSSimpleTypeDefinition

getWhitespace

public short getWhitespace()
            throws DatatypeException
Return the whitespace corresponding to this datatype.
Specified by:
getWhitespace in interface XSSimpleType
Returns:
valid values are WS_PRESERVE, WS_REPLACE, WS_COLLAPSE.
Throws:
DatatypeException - union datatypes don't have whitespace facet associated with them

isDOMDerivedFrom

public boolean isDOMDerivedFrom(String ancestorNS,
                                String ancestorName,
                                int derivationMethod)
Checks if a type is derived from another by restriction, given the name and namespace. See: http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#TypeInfo-isDerivedFrom
Parameters:
ancestorNS - The namspace of the ancestor type declaration
ancestorName - The name of the ancestor type declaration
derivationMethod - The derivation method
Returns:
boolean True if the ancestor type is derived from the reference type by the specifiied derivation method.

isDefinedFacet

public boolean isDefinedFacet(short facetName)
Convenience method. [Facets]: check whether a facet is defined on this type.
Specified by:
isDefinedFacet in interface org.apache.xerces.xs.XSSimpleTypeDefinition
Parameters:
facetName - The name of the facet.
Returns:
True if the facet is defined, false otherwise.

isDerivedFrom

public boolean isDerivedFrom(String typeNamespaceArg,
                             String typeNameArg,
                             int derivationMethod)
Specified by:
isDerivedFrom in interface org.w3c.dom.TypeInfo

isEqual

public boolean isEqual(Object value1,
                       Object value2)
Check whether two actual values are equal.
Specified by:
isEqual in interface XSSimpleType
Parameters:
value1 - the first value
value2 - the second value
Returns:
true if the two value are equal

isFinal

public boolean isFinal(short derivation)
Specified by:
isFinal in interface org.apache.xerces.xs.XSTypeDefinition

isFixedFacet

public boolean isFixedFacet(short facetName)
Convenience method. [Facets]: check whether a facet is defined and fixed on this type.
Specified by:
isFixedFacet in interface org.apache.xerces.xs.XSSimpleTypeDefinition
Parameters:
facetName - The name of the facet.
Returns:
True if the facet is fixed, false otherwise.

isIDType

public boolean isIDType()
Check whether this type is or is derived from ID. REVISIT: this method makes ID special, which is not a good design. but since ID is not a primitive, there doesn't seem to be a clean way of doing it except to define special method like this.
Specified by:
isIDType in interface XSSimpleType
Returns:
whether this simple type is or is derived from ID.

isIdentical

public boolean isIdentical(Object value1,
                           Object value2)

normalize

protected String normalize(Object content,
                           short ws)

normalize

public static String normalize(String content,
                               short ws)

reset

public void reset()

setAnonymous

public void setAnonymous(boolean anon)

setListValues

protected XSSimpleTypeDecl setListValues(String name,
                                         String uri,
                                         short finalSet,
                                         XSSimpleTypeDecl itemType,
                                         org.apache.xerces.xs.XSObjectList annotations)

setRestrictionValues

protected XSSimpleTypeDecl setRestrictionValues(XSSimpleTypeDecl base,
                                                String name,
                                                String uri,
                                                short finalSet,
                                                org.apache.xerces.xs.XSObjectList annotations)

setUnionValues

protected XSSimpleTypeDecl setUnionValues(String name,
                                          String uri,
                                          short finalSet,
                                          XSSimpleTypeDecl[] memberTypes,
                                          org.apache.xerces.xs.XSObjectList annotations)

toString

public String toString()
See Also:
java.lang.Object.toString()

validate

public Object validate(Object content,
                       ValidationContext context,
                       ValidatedInfo validatedInfo)
            throws InvalidDatatypeValueException
validate a value, and return the compiled form
Specified by:
validate in interface XSSimpleType

validate

public Object validate(String content,
                       ValidationContext context,
                       ValidatedInfo validatedInfo)
            throws InvalidDatatypeValueException
validate a value, and return the compiled form
Specified by:
validate in interface XSSimpleType

validate

public void validate(ValidationContext context,
                     ValidatedInfo validatedInfo)
            throws InvalidDatatypeValueException
validate an actual value against this DV
Specified by:
validate in interface XSSimpleType
Parameters:
context - the validation context
validatedInfo - used to provide the actual value and member types

validateWithInfo

public ValidatedInfo validateWithInfo(String content,
                                      ValidationContext context,
                                      ValidatedInfo validatedInfo)
            throws InvalidDatatypeValueException
validate a value, and return the compiled form

Copyright B) 1999-2006 The Apache Software Foundation. All Rights Reserved.