public abstract class AbstractXMLValidator extends Object implements Validator
Modifier and Type | Field and Description |
---|---|
protected Document |
document
Document to be validated.
|
protected DocumentBuilder |
documentBuilder
XML document builder.
|
protected XMLErrorHandler |
errorHandler
Error handler.
|
Constructor and Description |
---|
AbstractXMLValidator()
Constructor.
|
AbstractXMLValidator(boolean validateXML)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addError(ValidationError.Type errorType,
int line,
int column,
String message)
Add an error message to the list.
|
void |
clear()
Clear the validator errors.
|
protected XMLErrorHandler |
createXMLErrorHandler() |
Document |
getDocument() |
protected XMLErrorHandler |
getErrorHandler() |
List<ValidationError> |
getErrors()
Get the list of validation errors.
|
void |
setDocument(InputStream document)
Set document to validate.
|
void |
setValidateXML(boolean validateXML) |
List<ValidationError> |
validate()
Run validation.
|
protected void |
validate(Document document) |
protected Document document
protected XMLErrorHandler errorHandler
protected DocumentBuilder documentBuilder
public AbstractXMLValidator()
public AbstractXMLValidator(boolean validateXML)
validateXML
- indicate if the XML input should be validated.protected XMLErrorHandler createXMLErrorHandler()
public void setValidateXML(boolean validateXML)
validateXML
- indicate if the XML input should be validated.public void setDocument(InputStream document)
Validator
setDocument
in interface Validator
document
- document to validatepublic List<ValidationError> validate()
Validator
protected void validate(Document document)
document
- the XML documentpublic List<ValidationError> getErrors()
Validator
public Document getDocument()
protected XMLErrorHandler getErrorHandler()
protected void addError(ValidationError.Type errorType, int line, int column, String message)
errorType
- type of the errorline
- line where the error occurredcolumn
- where the error occurredmessage
- the message to addCopyright © 2004–2021 XWiki. All rights reserved.