mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
#41 fix validation of garbage e.g. non xml files
This commit is contained in:
parent
2d85fccd95
commit
fa5966d464
17 changed files with 134 additions and 62 deletions
|
|
@ -1,6 +1,6 @@
|
|||
package de.kosit.validationtool.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -45,10 +45,7 @@ public class DefaultResult implements Result {
|
|||
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
@Getter
|
||||
private List<XmlError> schemaViolations = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private final List<String> processingErrors = new ArrayList<>();
|
||||
private List<XmlError> schemaViolations;
|
||||
|
||||
@Getter
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
|
|
@ -58,12 +55,21 @@ public class DefaultResult implements Result {
|
|||
@Setter
|
||||
private boolean processingSuccessful;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean wellformed;
|
||||
|
||||
public DefaultResult(final XdmNode report, final AcceptRecommendation recommendation, final HtmlExtractor htmlExtractor) {
|
||||
this.report = report;
|
||||
this.acceptRecommendation = recommendation;
|
||||
this.htmlExtraction = htmlExtractor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getProcessingErrors() {
|
||||
return getReportInput().getProcessingError() != null ? getReportInput().getProcessingError().getError() : Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt den Report als W3C-{@link Document} zurück.
|
||||
*
|
||||
|
|
@ -84,6 +90,11 @@ public class DefaultResult implements Result {
|
|||
return isProcessingSuccessful() && AcceptRecommendation.ACCEPTABLE.equals(this.acceptRecommendation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSchemaValid() {
|
||||
return getSchemaViolations() != null && getSchemaViolations().isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extrahiert evtl. im Report vorhandene HTML-Fragmente als String.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue