Skip to content

Commit

Permalink
remove older, unused method #3845
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Aug 14, 2017
1 parent fb8b597 commit 825332b
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/main/java/edu/harvard/iq/dataverse/util/xml/XmlValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,6 @@ public static boolean validateXml(String fileToValidate, URL schemaToValidateAga
}
}

public static boolean validateXml(String fileToValidate, String schemaToValidateAgainst) throws IOException, SAXException {
System.out.print(" before get schema file " + schemaToValidateAgainst);
StreamSource schemaFile = new StreamSource(new File(schemaToValidateAgainst));
// StreamSource schemaFile = new StreamSource(new URL(schemaToValidateAgainst).openStream());
System.out.print(" after get schema file ");
Source xmlFile = new StreamSource(new File(fileToValidate));
System.out.print(" after get file to validate ");
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
System.out.print(" after get schema factory ");
Schema schema = schemaFactory.newSchema(schemaFile);
System.out.print(" after instantiate Schema ");
Validator validator = schema.newValidator();
System.out.print(" after instantiate Validator ");
try {
validator.validate(xmlFile);
logger.info(xmlFile.getSystemId() + " is valid");
return true;
} catch (SAXException ex) {
System.out.print(ex.getMessage());
System.out.print(ex.getLocalizedMessage());
logger.info(xmlFile.getSystemId() + " is not valid: " + ex.getLocalizedMessage());
return false;
}
}

/**
* @param filename XML file on disk to check for well-formedness.
* @return true if well-formed or an exception with a message about why if
Expand Down

0 comments on commit 825332b

Please sign in to comment.