|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.saxonica.schema.SchemaStructure
com.saxonica.schema.SimpleComponentReference
com.saxonica.schema.AttributeUse
public final class AttributeUse
An XML Schema Attribute Use: that is, a reference to an attribute declaration from within a complex type or attribute group.
This corresponds to an xs:attribute ref="" element in the XML representation of the schema.
Technically, a local attribute declaration (a non global xs:attribute name="") should be represented by two schema components, an attribute use and an attribute declaration. We don't currently do this, instead the containing attribute group refers to the attribute declaration directly.
| Field Summary | |
|---|---|
static short |
OPTIONAL
Value representing use="optional" |
static short |
PROHIBITED
Value representing use="prohibited" |
static short |
REQUIRED
Value representing use="required" |
| Fields inherited from class com.saxonica.schema.SimpleComponentReference |
|---|
nameCode, symbolSpace, target |
| Fields inherited from interface net.sf.saxon.type.SchemaComponent |
|---|
FIXED_UP, INCOMPLETE, INVALID, UNVALIDATED, VALIDATED, VALIDATING |
| Constructor Summary | |
|---|---|
AttributeUse(EnterpriseConfiguration config)
Creates a new Attribute Use in the given schema. |
|
| Method Summary | |
|---|---|
boolean |
fixup(SchemaCompiler compiler)
Fix up references to other elements in the schema. |
AttributeDecl |
getAttributeDeclaration()
Get the corresponding attribute declaration |
int |
getCardinality()
Get the value of the "use" attribute, expressed as a Cardinality value of StaticProperty.EXACTLY_ONE, StaticProperty.EMPTY, or
StaticProperty.ALLOWS_ZERO_OR_ONE |
String |
getDefaultValue()
Returns the default value of this attribute use. |
String |
getDisplayName()
Returns the name of the attribute defined by this AttributeDecl. |
Value |
getFixedValue()
Returns the fixed value of this attribute use. |
String |
getUnderlyingDefaultValue()
Get the default value of this attribute use if there is one; if there is none, get the default value of the corresponding attribute declaration; if the declaration defines no default value, return null |
Value |
getUnderlyingFixedValue()
Returns the fixed value of this attribute use, or of the corresponding attribute declaration if the attribute use has no fixed value. |
String |
getUse()
Get the value of the 'use' attribute for this attribute declaration or attribute reference. |
boolean |
isInheritable()
Ask whether this attribute is inheritable |
boolean |
isOptional()
Returns true if the use attribute is equal to "optional". |
boolean |
isProhibited()
Returns true if the use attribute is equal to "prohibited". |
boolean |
isRequired()
Returns true if the 'use' attribute is equal to REQUIRED and there is no specified value. |
void |
serialize(SchemaModelSerializer serializer)
Serialize the schema component |
void |
setDefaultValue(String value)
Sets the default value. |
void |
setFixedValue(Value value)
Sets the fixed value. |
void |
setInheritable(int inherit)
Say whether this attribute is inheritable |
void |
setNamespaceResolver(NamespaceResolver resolver)
Set the namespace resolver for resolving QName-valued fixed and default values |
void |
setUse(short value)
Sets the 'use' attribute of this attribute declaration. |
boolean |
testFixedValue(CharSequence value,
NamespaceResolver resolver)
Test a value against the fixed value. |
boolean |
validate(SchemaCompiler compiler)
Checks the validity of this Attribute Use |
| Methods inherited from class com.saxonica.schema.SimpleComponentReference |
|---|
getFingerprint, getNameCode, getSymbolSpace, getTarget, isResolved, setNameCode, setTarget, tryToResolve |
| Methods inherited from class com.saxonica.schema.SchemaStructure |
|---|
elaborate, getColumnNumber, getConfiguration, getFixupStatus, getLineNumber, getPublicId, getRedefinitionLevel, getSchemaDocumentURI, getSystemId, getValidationStatus, lookForCycles, setConfiguration, setFixupStatus, setLineNumber, setLocator, setRedefinitionLevel, setSchemaDocumentURI, setSystemId, setValidationStatus |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.saxonica.schema.UserSchemaComponent |
|---|
elaborate, lookForCycles |
| Methods inherited from interface net.sf.saxon.type.SchemaComponent |
|---|
getRedefinitionLevel, getValidationStatus |
| Methods inherited from interface com.saxonica.schema.ComponentReference |
|---|
getConfiguration |
| Methods inherited from interface javax.xml.transform.SourceLocator |
|---|
getColumnNumber, getLineNumber, getPublicId, getSystemId |
| Field Detail |
|---|
public static final short OPTIONAL
public static final short PROHIBITED
public static final short REQUIRED
| Constructor Detail |
|---|
public AttributeUse(EnterpriseConfiguration config)
config - the Configuration that contains the new attributeUse| Method Detail |
|---|
public AttributeDecl getAttributeDeclaration()
throws UnresolvedReferenceException
UnresolvedReferenceException - if the reference from the AttributeUse
to the AttributeDecl has not been resolvedpublic String getDisplayName()
public String getUse()
public int getCardinality()
StaticProperty.EXACTLY_ONE, StaticProperty.EMPTY, or
StaticProperty.ALLOWS_ZERO_OR_ONE
public String getDefaultValue()
public String getUnderlyingDefaultValue()
public Value getFixedValue()
public Value getUnderlyingFixedValue()
public void setNamespaceResolver(NamespaceResolver resolver)
resolver - the namespace resolver to be used
public boolean testFixedValue(CharSequence value,
NamespaceResolver resolver)
throws ValidationException
value - the value to be testedresolver - the namespace resolver to be used if the value is namespace sensitive
ValidationException - if the value is not valid for this typepublic boolean isOptional()
public boolean isProhibited()
public boolean isRequired()
public void setUse(short value)
value - one of the following:
("prohibited" | "optional" | "required")public void setDefaultValue(String value)
value - the default valuepublic void setFixedValue(Value value)
value - the fixed valuepublic void setInheritable(int inherit)
inherit - values are 0 (false), 1 (true), -1 (unspecified, use value
from attribute declaration)public boolean isInheritable()
public boolean fixup(SchemaCompiler compiler)
throws SchemaException
fixup in interface UserSchemaComponentfixup in class SchemaStructurecompiler - the schema compiler, used for error reporting
SchemaException
public boolean validate(SchemaCompiler compiler)
throws SchemaException
validate in interface UserSchemaComponentSchemaException - if the error listener decides an error is fatal
public void serialize(SchemaModelSerializer serializer)
throws XPathException
serializer - the schema serializer
XPathException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||