public abstract class ContentValidator extends ValidatingFilter
Modifier and Type | Class and Description |
---|---|
static class |
ContentValidator.Nillability |
Modifier and Type | Field and Description |
---|---|
protected ContentValidator |
childValidator |
protected boolean |
nil |
protected java.util.List<java.lang.String> |
pendingMessages |
locallyInvalid
nextReceiver
pipelineConfiguration, previousAtomic, systemId
Constructor and Description |
---|
ContentValidator(Receiver next) |
Modifier and Type | Method and Description |
---|---|
protected void |
checkNoCharactersWhenNil(Location location)
Character content was encountered; check that this does not conflict with an xsi:nil=true attribute
|
protected void |
checkNoChildrenWhenNil(Location location)
A child element was encountered; check that this does not conflict with an xsi:nil=true attribute
|
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.
|
StructuredQName |
getContainingElement()
Get the name of the element being validated (for diagnostics).
|
Location |
getContainingElementLocationId()
Get the location of the element being validated
|
protected java.lang.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
|
ContentValidator.Nillability |
getNillability()
Determine whether this type permits xsi:nil = true BlockCom
|
abstract SchemaType |
getSchemaType()
Get the schema type against which we are validating, if any
|
boolean |
isNil()
Determine whether xsi:nil = true was set on this element
|
protected void |
makeChildValidator(ElementDecl decl,
StructuredQName elementName,
Location locationId,
int process)
Make a validator for the children of the element whose start tag is currently being processed.
|
static ContentValidator |
makeValidator(ElementDecl decl,
StructuredQName elementName,
Location locationId,
ValidationContext validationContext,
SchemaType governingType,
int validation,
PipelineConfiguration pipe,
Receiver nextReceiver,
java.util.List<ValidationFailure> failures)
Factory method to make a validator for a particular element
|
static ContentValidator |
makeValidatorForType(ElementDecl elementDecl,
SchemaType schemaType,
PipelineConfiguration pipe,
Receiver nextReceiver,
java.util.List<ValidationFailure> failures)
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 |
setContainingElement(StructuredQName name,
Location locationId)
Set 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(ContentValidator.Nillability nillability)
Set whether this type permits xsi:nil = true
|
void |
startElement(NodeName nameCode,
SchemaType typeCode,
Location location,
int properties)
Handle the start tag for a child element of the element being validated
|
append, getConstraintChecker, getStartTagBuffer, getValidationContext, reportIfInvalid, reportValidationError, setConstraintChecker, setStartTagBuffer, setValidationContext, usesTypeAnnotations
attribute, characters, close, comment, endElement, getNamePool, getNextReceiver, namespace, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startContent, startDocument
append, decompose, flatten, getConfiguration, getErrorCodeForDecomposingFunctionItems, getPipelineConfiguration, getSystemId, handlesAppend
protected ContentValidator childValidator
protected boolean nil
protected java.util.List<java.lang.String> pendingMessages
public ContentValidator(Receiver next)
public void setContainingElement(StructuredQName name, Location locationId)
name
- 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 StructuredQName getContainingElement()
public Location getContainingElementLocationId()
protected java.lang.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 NamespaceResolver getNamespaceResolver()
public void setNillability(ContentValidator.Nillability nillability)
nillability
- one of ContentValidator.Nillability.IGNORED
, ContentValidator.Nillability.ALLOWED
, ContentValidator.Nillability.DISALLOWED
public ContentValidator.Nillability getNillability()
public boolean isNil()
public void startElement(NodeName nameCode, SchemaType typeCode, Location location, 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
- the element's type annotation.location
- a location associated with the event (typically either a location in the
source document or the stylesheet)properties
- properties of the element nodeXPathException
- if an error occurspublic static ContentValidator makeValidator(ElementDecl decl, StructuredQName elementName, Location locationId, ValidationContext validationContext, SchemaType governingType, int validation, PipelineConfiguration pipe, Receiver nextReceiver, java.util.List<ValidationFailure> failures) throws MissingComponentException
decl
- the element declaration to validate against. May be null.elementName
- 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)validationContext
- information about the validation episodegoverningType
- 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 pipelinefailures
- a list which the method will populate with ValidationFailure objects
in the event that a validity error is detected. (This is used to avoid throwing
exceptions in the case where validation failures are a normal event)MissingComponentException
protected abstract ContentValidator getChildValidator()
public static ContentValidator makeValidatorForType(ElementDecl elementDecl, SchemaType schemaType, PipelineConfiguration pipe, Receiver nextReceiver, java.util.List<ValidationFailure> failures) throws MissingComponentException
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 pipelinefailures
- a list which the method will populate with any validity errors discovered by the methodMissingComponentException
- if validation requires components that are missing from the schema. Note that unresolved
references are errors only if the component is actually used, so they are detected during validation.public void endDocument() throws XPathException
endDocument
in interface Receiver
endDocument
in class ProxyReceiver
XPathException
- if an error occursprotected void makeChildValidator(ElementDecl decl, StructuredQName elementName, Location locationId, int process) throws XPathException
decl
- the element declaration for this element, if applicableelementName
- the name of this element, used for diagnosticslocationId
- location information, used for diagnosticsXPathException
- if a validation error occurs and if recovery from validation errors
has not been requested. The error will always have been reported.protected void checkNoChildrenWhenNil(Location location) throws XPathException
location
- the location to be used in any error reportXPathException
- if processing should terminate, for example because of too many errorsprotected void checkNoCharactersWhenNil(Location location) throws XPathException
location
- the location to be used in any error reportXPathException
- if processing should terminate, for example because of too many errorsCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.