Mistři v programování na #hovnokod

Java #4592

Co udělá líný člověk, když dr blíží dedajna a pořád mu to nefunguje?

public static boolean validate(final File file) {
//     // URL schemaFile = new URL("http://host:port/filename.xsd");
// // webapp example xsd:
// // URL schemaFile = new URL("http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd");
// // local file example:
// // File schemaFile = new File("/location/to/localfile.xsd"); // etc.
//     try {
//       ClassLoader classLoader = Application.class.getClassLoader();
//       File schemaFile = new File(classLoader.getResource("xml/canon2scriptura-0.0.1.xsd").getFile());
//
//       // Source xmlFile = new StreamSource(new File("web.xml"));
//       Source xmlFile = new StreamSource(file);
//       SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
//       try {
//         Schema schema = schemaFactory.newSchema(schemaFile);
//         Validator validator = schema.newValidator();
//         validator.validate(xmlFile);
//         System.out.println(xmlFile.getSystemId() + " is valid");
//         return true;
//       } catch (SAXException e) {
//         System.out.println(xmlFile.getSystemId() + " is NOT valid reason:" + e);
//       } catch (IOException e) {}
//     } catch (Exception e) {
//       e.printStackTrace();
//     }


    // File docFile = new File("memory.xml");
    // try {
    //   DOMParser parser = new DOMParser();
    //   parser.setFeature("http://xml.org/sax/features/validation", true);
    //   parser.setProperty(
    //       "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
    //       "memory.xsd");
    //   ErrorChecker errors = new ErrorChecker();
    //   parser.setErrorHandler(errors);
    //   parser.parse("memory.xml");
    // } catch (Exception e) {
    //   System.out.print("Problem parsing the file.");
    // }

    return false;
  }

Filip Gregor,