Package com.saxonica.ee.schema
Class ValueConstraint
java.lang.Object
com.saxonica.ee.schema.ValueConstraint
A value constraint represents the default or fixed value of an element declaration, attribute
declaration, or attribute use
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionValueConstraint
(ValueConstraint.Variety variety, UnicodeString lexicalForm) Constructor; supplies the lexical form of the value as a string. -
Method Summary
Modifier and TypeMethodDescriptionFor use with the saxon:schema extension function, return the value constraint in the form of a functionReturns the lexical form of the valuegetValue()
Gets the value of the constraint as a typed value.Get the variety of the constraint (fixed or default)boolean
matches
(AtomicSequence supplied) Test whether a suplied value matches the constraintvoid
serialize
(SchemaModelSerializer serializer) Serialize the value constraintboolean
testFixedValue
(Configuration config, UnicodeString value, SimpleType type, NamespaceResolver resolver) Test that the actual value of an element or attribute conforms to the required fixed value
-
Constructor Details
-
ValueConstraint
Constructor; supplies the lexical form of the value as a string. The typed value will initially be set to the lexical form as an instance of UntypedAtomic. The lexical form may be null, in which casesetValue(net.sf.saxon.om.AtomicSequence)
must be called to supply the typed value
-
-
Method Details
-
getVariety
Get the variety of the constraint (fixed or default)- Returns:
- the variety
-
getLexicalForm
Returns the lexical form of the value- Returns:
- the fixed or default value defined by this component. The value returned is the value after whitespace normalization is applied to the value as written in the source schema.
-
getValue
Gets the value of the constraint as a typed value.- Returns:
- the value. This will initially be saved as an UntypedAtomicValue; later, when the type is known, it will be converted to the correct type
-
matches
Test whether a suplied value matches the constraint -
asFunction
For use with the saxon:schema extension function, return the value constraint in the form of a function- Returns:
- a function whose result gives details of the value constraint
-
testFixedValue
public boolean testFixedValue(Configuration config, UnicodeString value, SimpleType type, NamespaceResolver resolver) throws ValidationException Test that the actual value of an element or attribute conforms to the required fixed value- Parameters:
config
- the Saxon configurationvalue
- the actual valuetype
- the required typeresolver
- a namespace resolver, in case QNames are involved- Returns:
- true if the value is OK, otherwise false
- Throws:
ValidationException
- if the value is not valid as an instance of the type
-
serialize
Serialize the value constraint- Throws:
XPathException
-