use of javax.xml.transform.Source in project ORCID-Source by ORCID.
the class ValidateV2RC3Identifiers method validateSampleXML.
public void validateSampleXML(String name) throws SAXException, IOException {
Source source = getInputStream("/record_2.0_rc3/samples/" + name + "-2.0_rc3.xml");
Validator validator = getValidator(name);
validator.validate(source);
}
use of javax.xml.transform.Source in project ORCID-Source by ORCID.
the class ValidateV2RC3Identifiers method getInputStream.
private Source getInputStream(String loc) {
InputStream inputStream = MarshallingTest.class.getResourceAsStream(loc);
Source source = new StreamSource(inputStream);
return source;
}
use of javax.xml.transform.Source in project ORCID-Source by ORCID.
the class ValidateV2RC1SamplesTest method getInputStream.
private Source getInputStream(String loc) {
InputStream inputStream = MarshallingTest.class.getResourceAsStream(loc);
Source source = new StreamSource(inputStream);
return source;
}
use of javax.xml.transform.Source in project ORCID-Source by ORCID.
the class ValidateV2RC1SamplesTest method validateSampleXML.
public void validateSampleXML(String name) throws SAXException, IOException {
Source source = getInputStream("/record_2.0_rc1/samples/" + name + "-2.0_rc1.xml");
Validator validator = getValidator(name);
validator.validate(source);
}
use of javax.xml.transform.Source in project ORCID-Source by ORCID.
the class ValidateOrcidMessage method validAgainstSchema.
private static boolean validAgainstSchema(File fileToValidate) {
Validator validator = createValidator();
Source source = new StreamSource(fileToValidate);
try {
validator.validate(source);
System.out.println(fileToValidate + " is valid");
return true;
} catch (SAXException e) {
System.out.println(fileToValidate + " is invalid");
System.out.println(e);
} catch (IOException e) {
System.out.println("Unable to read file " + fileToValidate);
}
return false;
}
Aggregations