public abstract class AbstractXmlValidator extends Object implements IConfigurationAware
Modifier and Type | Class and Description |
---|---|
static class |
AbstractXmlValidator.ValidationResult |
Modifier and Type | Field and Description |
---|---|
protected Boolean |
ignoreUnknownNamespaces |
protected static org.apache.logging.log4j.Logger |
log |
protected String |
logPrefix |
protected SchemasProvider |
schemasProvider |
protected boolean |
warn |
Constructor and Description |
---|
AbstractXmlValidator() |
Modifier and Type | Method and Description |
---|---|
void |
configure(IConfigurationAware owner)
Configure the XmlValidator
|
ValidationContext |
createValidationContext(PipeLineSession session,
RootValidations rootValidations,
Map<List<String>,List<String>> invalidRootNamespaces) |
AbstractXmlValidator.ValidationResult |
finalizeValidation(ValidationContext context,
PipeLineSession session,
Throwable t)
Evaluate the validation and set 'reason' session variables.
|
protected InputSource |
getInputSource(Message input) |
protected String |
getLogPrefix(PipeLineSession session) |
String |
getName() |
abstract ValidatorHandler |
getValidatorHandler(PipeLineSession session,
ValidationContext context) |
abstract List<org.apache.xerces.xs.XSModel> |
getXSModels() |
boolean |
isXmlSchema1_0() |
void |
setCharset(String string)
Characterset used for reading file, only used when
validateFile is true |
void |
setFullSchemaChecking(boolean fullSchemaChecking)
Enable full schema grammar constraint checking, including checking which
may be time-consuming or memory intensive.
|
void |
setIgnoreCaching(boolean ignoreCaching)
If set
true , the number for caching validators in appConstants is ignored and no caching is done (for this validator only) |
void |
setIgnoreUnknownNamespaces(Boolean b)
Ignore namespaces in the input message which are unknown
|
void |
setReasonSessionKey(String reasonSessionKey)
If set: key of session variable to store reasons of mis-validation in
|
void |
setThrowException(boolean throwException)
Should the XmlValidator throw a PipeRunexception on a validation error.
|
void |
setValidateFile(boolean b)
If set
true , the input is assumed to be the name of the file to be validated. |
void |
setWarn(boolean warn)
If set
true , send warnings to logging and console about syntax problems in the configured schema('s). |
void |
setXmlReasonSessionKey(String xmlReasonSessionKey)
Like
reasonSessionKey but stores reasons in xml format and more extensive |
void |
setXmlSchemaVersion(String xmlSchemaVersion)
If set to
1.0 , Xerces's previous XML Schema factory will be used, which would make all XSD 1.1 features illegal. |
void |
start() |
void |
stop() |
AbstractXmlValidator.ValidationResult |
validate(InputSource inputSource,
ValidatorHandler validatorHandler,
PipeLineSession session,
ValidationContext context) |
AbstractXmlValidator.ValidationResult |
validate(Object input,
PipeLineSession session,
String logPrefix,
RootValidations rootValidations,
Map<List<String>,List<String>> invalidRootNamespaces) |
AbstractXmlValidator.ValidationResult |
validate(Object input,
PipeLineSession session,
ValidatorHandler validatorHandler,
XMLFilterImpl filter,
ValidationContext context) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getApplicationContext
getConfigurationClassLoader
protected static org.apache.logging.log4j.Logger log
protected boolean warn
protected String logPrefix
protected Boolean ignoreUnknownNamespaces
protected SchemasProvider schemasProvider
public void configure(IConfigurationAware owner) throws ConfigurationException
ConfigurationException
- when:
#isThrowException()
is false and there is no forward defined for "failure"public String getName()
getName
in interface IConfigurationAware
public void start() throws ConfigurationException
ConfigurationException
public void stop()
public ValidationContext createValidationContext(PipeLineSession session, RootValidations rootValidations, Map<List<String>,List<String>> invalidRootNamespaces) throws ConfigurationException, PipeRunException
public AbstractXmlValidator.ValidationResult finalizeValidation(ValidationContext context, PipeLineSession session, Throwable t) throws XmlValidatorException
context
- the validationContext of this attemptsession
- the PipeLineSessiont
- the exception thrown by the validation, or nullXmlValidatorException,
- when configured to do soXmlValidatorException
public abstract ValidatorHandler getValidatorHandler(PipeLineSession session, ValidationContext context) throws ConfigurationException, PipeRunException
public abstract List<org.apache.xerces.xs.XSModel> getXSModels()
public AbstractXmlValidator.ValidationResult validate(Object input, PipeLineSession session, String logPrefix, RootValidations rootValidations, Map<List<String>,List<String>> invalidRootNamespaces) throws XmlValidatorException, PipeRunException, ConfigurationException
input
- the XML string to validatesession
- a pipeLineSession
XmlValidatorException
- when isThrowException
is true and a validationerror occurred.PipeRunException
ConfigurationException
public AbstractXmlValidator.ValidationResult validate(Object input, PipeLineSession session, ValidatorHandler validatorHandler, XMLFilterImpl filter, ValidationContext context) throws XmlValidatorException, PipeRunException, ConfigurationException
public AbstractXmlValidator.ValidationResult validate(InputSource inputSource, ValidatorHandler validatorHandler, PipeLineSession session, ValidationContext context) throws XmlValidatorException
XmlValidatorException
protected String getLogPrefix(PipeLineSession session)
protected InputSource getInputSource(Message input) throws XmlValidatorException
XmlValidatorException
public void setFullSchemaChecking(boolean fullSchemaChecking)
see property http://apache.org/xml/features/validation/schema-full-checking
false
public void setThrowException(boolean throwException)
public void setReasonSessionKey(String reasonSessionKey)
public void setXmlReasonSessionKey(String xmlReasonSessionKey)
reasonSessionKey
but stores reasons in xml format and more extensivepublic void setValidateFile(boolean b)
true
, the input is assumed to be the name of the file to be validated. Otherwise the input itself is validatedpublic void setCharset(String string)
validateFile
is true
public void setWarn(boolean warn)
true
, send warnings to logging and console about syntax problems in the configured schema('s).
Alternatively, warnings can be switched off using suppression properties , and public void setIgnoreUnknownNamespaces(Boolean b)
schema
or noNamespaceSchemaLocation
is used, false otherwisepublic void setIgnoreCaching(boolean ignoreCaching)
true
, the number for caching validators in appConstants is ignored and no caching is done (for this validator only)public void setXmlSchemaVersion(String xmlSchemaVersion)
1.0
, Xerces's previous XML Schema factory will be used, which would make all XSD 1.1 features illegal. The default behaviour can also be set with xsd.processor.version
property.1.1
public boolean isXmlSchema1_0()
Copyright © 2023 Frank!Framework. All rights reserved.