|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.saxon.event.SequenceReceiver net.sf.saxon.event.ProxyReceiver com.saxonica.validate.ValidatingFilter com.saxonica.validate.ContentValidator
public abstract class ContentValidator
This class is an abstract superclass for all the validators. The class includes factory methods for constructing a validator.
Field Summary | |
---|---|
protected boolean |
nil
|
static int |
NIL_ALLOWED
Constant indicating that xsi:nil is allowed and active. |
static int |
NIL_DISALLOWED
Constant indicating that xsi:nil is disallowed. |
static int |
NIL_IGNORED
Constant indicating that xsi:nil is allowed but ignored; this is true when we are validating against a type, rather than against an element declaration |
protected List<String> |
pendingMessages
|
protected SchemaType |
xsiType
|
Fields inherited from class net.sf.saxon.event.ProxyReceiver |
---|
nextReceiver |
Fields inherited from class net.sf.saxon.event.SequenceReceiver |
---|
pipelineConfiguration, previousAtomic, systemId |
Fields inherited from interface javax.xml.transform.Result |
---|
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING |
Constructor Summary | |
---|---|
ContentValidator(Receiver next)
|
Method Summary | |
---|---|
void |
endDocument()
Notify the end of a document node |
protected SchemaType |
getAnnotation()
Get the type annotation code to be used on elements validated by this validator |
protected abstract ContentValidator |
getChildValidator()
Get a validator to handle the children of the current element. |
protected ConstraintChecker |
getConstraintChecker()
Get the constraint checker used in this pipeline |
int |
getContainingElement()
Get the fingerprint of the name of the element being validated (for diagnostics). |
int |
getContainingElementLocationId()
Get the location ID of the element being validated |
protected String |
getContainingElementName()
Get the containing element name, for use in error messages. |
protected ElementDecl |
getElementDeclaration()
Get the element declaration that this validator is validating against |
NamespaceResolver |
getNamespaceResolver()
Get the namespace resolver |
int |
getNillability()
Determine whether this type permits xsi:nil = true BlockCom |
abstract SchemaType |
getSchemaType()
Get the schema type against which we are validating, if any |
StartTagBufferEE |
getStartTagBuffer()
Get the startTagBuffer |
boolean |
isNil()
Determine whether xsi:nil = true was set on this element |
static ContentValidator |
makeValidator(ElementDecl decl,
int nameCode,
int locationId,
StartTagBufferEE startTagBuffer,
SchemaType governingType,
int validation,
PipelineConfiguration pipe,
Receiver nextReceiver)
Factory method to make a validator for a particular element |
static ContentValidator |
makeValidatorForType(ElementDecl elementDecl,
SchemaType schemaType,
PipelineConfiguration pipe,
Receiver nextReceiver)
Factory method to create a validator for elements of a given type |
protected void |
setAnnotation(SchemaType annotation)
Set the type annotation code to be allocated by this validator |
void |
setConstraintChecker(ConstraintChecker checker)
Set the constraint checker used in this pipeline |
void |
setContainingElement(int fingerprint,
int locationId)
Set the fingerprint identifying the name of the containing element (for diagnostics) |
protected void |
setElementDeclaration(ElementDecl decl)
Set the element declaration that this validator is validating against |
void |
setNillability(int nillability)
Set whether this type permits xsi:nil = true |
void |
setStartTagBuffer(StartTagBufferEE startTag)
Set the StartTagBuffer, which buffers attributes on the element start tag, and also acts as the namespaceResolver to be used for resolving QName-valued attributes |
void |
setXSIType(SchemaType xsiType)
Set the value of the xsi:type attribute. |
void |
startElement(NodeName nameCode,
SchemaType typeCode,
int locationId,
int properties)
Handle the start tag for a child element of the element being validated |
Methods inherited from class com.saxonica.validate.ValidatingFilter |
---|
append, getErrorCode, getInvalidity, isInvalid, reportIfInvalid, reportValidationError, setErrorCode, setInvalidity, usesTypeAnnotations |
Methods inherited from class net.sf.saxon.event.ProxyReceiver |
---|
attribute, characters, close, comment, endElement, getNamePool, getUnderlyingReceiver, namespace, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startContent, startDocument |
Methods inherited from class net.sf.saxon.event.SequenceReceiver |
---|
append, getConfiguration, getPipelineConfiguration, getSystemId |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NIL_IGNORED
public static final int NIL_ALLOWED
public static final int NIL_DISALLOWED
protected SchemaType xsiType
protected boolean nil
protected List<String> pendingMessages
Constructor Detail |
---|
public ContentValidator(Receiver next)
Method Detail |
---|
public void setContainingElement(int fingerprint, int locationId)
fingerprint
- identifies the name of the containing elementlocationId
- identifies the location of the containing elementprotected void setElementDeclaration(ElementDecl decl)
decl
- the element declarationprotected ElementDecl getElementDeclaration()
public void setConstraintChecker(ConstraintChecker checker)
checker
- the constraint checkerprotected ConstraintChecker getConstraintChecker()
public int getContainingElement()
public int getContainingElementLocationId()
protected String getContainingElementName()
public abstract SchemaType getSchemaType()
protected final void setAnnotation(SchemaType annotation)
annotation
- the integer fingerprint of the name of the typeprotected final SchemaType getAnnotation()
public void setXSIType(SchemaType xsiType)
xsiType
- the schema type identified by the xsi:type attributepublic void setStartTagBuffer(StartTagBufferEE startTag)
startTag
- the namespace resolverpublic StartTagBufferEE getStartTagBuffer()
public NamespaceResolver getNamespaceResolver()
public void setNillability(int nillability)
nillability
- one of NIL_IGNORED
, NIL_ALLOWED
, NIL_DISALLOWED
public int getNillability()
NIL_IGNORED
, NIL_ALLOWED
, NIL_DISALLOWED
public boolean isNil()
public void startElement(NodeName nameCode, SchemaType typeCode, int locationId, int properties) throws XPathException
startElement
in interface Receiver
startElement
in class ProxyReceiver
nameCode
- integer code identifying the name of the element within the name pool.typeCode
- integer code identifying the element's type within the name pool.locationId
- an integer which can be interpreted using a LocationProvider
to return
information such as line number and system ID. If no location information is available,
the value zero is supplied.properties
- properties of the element node
XPathException
- if an error occurspublic static ContentValidator makeValidator(ElementDecl decl, int nameCode, int locationId, StartTagBufferEE startTagBuffer, SchemaType governingType, int validation, PipelineConfiguration pipe, Receiver nextReceiver) throws XPathException
decl
- the element declaration to validate against. May be null.nameCode
- the name of the element (used only for diagnostics)locationId
- the location of the element, or of the stylesheet instruction that generated this element (or zero)startTagBuffer
- the start tag buffer holding the attributes of the element to be validated,
as required for conditional type assigmment. May be null (not available on all paths)governingType
- the type identified by xsi:type, if specified; otherwise nullvalidation
- the validation mode (strict, lax, preserve, strip)pipe
- the pipeline configurationnextReceiver
- the next receiver in the pipeline
XPathException
- if a validator cannot be created, for example because
neither an element declaration nor a governing type is suppliedprotected abstract ContentValidator getChildValidator()
public static ContentValidator makeValidatorForType(ElementDecl elementDecl, SchemaType schemaType, PipelineConfiguration pipe, Receiver nextReceiver) throws ValidationException
elementDecl
- the element declaration if available, otherwise null
(there will be no element declaration, for example, when doing lax validation
against an xsi:type)schemaType
- the simple or complex type against which the content of the
element is to be validatedpipe
- the pipeline configurationnextReceiver
- the next receiver in the pipeline
ValidationException
- if a validator cannot be constructed,
for example because the requested type is xs:untypedAtomicpublic void endDocument() throws XPathException
endDocument
in interface Receiver
endDocument
in class ProxyReceiver
XPathException
- if an error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |