mirror of
https://github.com/itplr-kosit/validator.git
synced 2026-05-25 16:55:39 +00:00
(fix) compile
This commit is contained in:
parent
0a28e41d98
commit
f491d6897e
2 changed files with 32 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import java.util.stream.Collectors;
|
|||
import org.oclc.purl.dsdl.svrl.FailedAssert;
|
||||
import org.oclc.purl.dsdl.svrl.SchematronOutput;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
|
@ -83,14 +84,33 @@ public class DefaultResult implements Result {
|
|||
return isProcessingSuccessful() && AcceptRecommendation.ACCEPTABLE.equals(this.acceptRecommendation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extrahiert evtl. im Report vorhandene HTML-Fragmente als String.
|
||||
*
|
||||
* @return Liste mit HTML Strings.
|
||||
*/
|
||||
public List<String> extractHtmlAsString() {
|
||||
return this.htmlExtraction.extractAsString(getReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* Extrahiert evtl. im Report vorhandene HTML-Fragmente.
|
||||
*
|
||||
* @return Liste mit HTML Nodes.
|
||||
*/
|
||||
public List<XdmNode> extractHtml() {
|
||||
return this.htmlExtraction.extract(getReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* Extrahiert evtl. im Report vorhandene HTML-Fragmente als {@link Element}.
|
||||
*
|
||||
* @return Liste mit HTML Elementen.
|
||||
*/
|
||||
public List<Element> extractHtmlAsElement() {
|
||||
return this.htmlExtraction.extractAsElement(getReport());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt alle Schematron-Ergebnisse vom Typ {@link FailedAssert} zurück.
|
||||
*
|
||||
|
|
@ -103,4 +123,5 @@ public class DefaultResult implements Result {
|
|||
private <T> List<T> filterSchematronResult(final Class<T> type) {
|
||||
return getSchematronResult().stream().filter(type::isInstance).map(type::cast).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,8 +6,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import net.sf.saxon.dom.NodeOverNodeInfo;
|
||||
import net.sf.saxon.s9api.SaxonApiException;
|
||||
import net.sf.saxon.s9api.Serializer;
|
||||
import net.sf.saxon.s9api.XPathExecutable;
|
||||
|
|
@ -71,4 +74,12 @@ public class HtmlExtractor {
|
|||
public List<String> extractAsString(final XdmNode node) {
|
||||
return extract(node).stream().map(HtmlExtractor::convertToString).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<Element> extractAsElement(final XdmNode node) {
|
||||
return extract(node).stream().map(HtmlExtractor::convertToElement).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static Element convertToElement(final XdmNode xdmItem) {
|
||||
return (Element) NodeOverNodeInfo.wrap(xdmItem.getUnderlyingNode());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue