public static boolean validate(InputStream deviceXml, OutputStream out, File parent) {
PrintWriter writer = new PrintWriter(out);
try {
if (!(deviceXml instanceof NonClosingInputStream)) {
deviceXml = new NonClosingInputStream(deviceXml);
((NonClosingInputStream) deviceXml).setCloseBehavior(CloseBehavior.RESET);
}
int version = getXmlSchemaVersion(deviceXml);
if (version < 1 || version > NS_LATEST_VERSION) {