@Test public void validateGetFeatureWithMissingSchemaLocation() { try { AppSchemaValidator.validate("<wfs:GetFeature " + "xmlns:wfs=\"http: + "<wfs:Query typeName=\"test\"/></wfs:GetFeature>"); Assert.fail("Unexpected validation success for GetFeature with missing schemaLocation"); } catch (Exception e) { Assert.assertEquals(e.getMessage(), "Schema validation failure caused by " + "missing schemaLocation for namespace http: } }
public static void validate(String xml) { byte[] bytes = null; String encoding = getEncoding(xml); if (encoding != null) { try { bytes = xml.getBytes(encoding); } catch (UnsupportedEncodingException e) { } } if (bytes == null) { bytes = xml.getBytes(); } InputStream input = null; try { input = new ByteArrayInputStream(bytes); validate(input); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } }
AppSchemaValidator { public static void validate(String xml) { byte[] bytes = null; String encoding = getEncoding(xml); if (encoding != null) { try { bytes = xml.getBytes(encoding); } catch (UnsupportedEncodingException e) { } } if (bytes == null) { bytes = xml.getBytes(); } InputStream input = null; try { input = new ByteArrayInputStream(bytes); validate(input); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } }
AppSchemaValidator { public static void validate(String xml) { byte[] bytes = null; String encoding = getEncoding(xml); if (encoding != null) { try { bytes = xml.getBytes(encoding); } catch (UnsupportedEncodingException e) { } } if (bytes == null) { bytes = xml.getBytes(); } InputStream input = null; try { input = new ByteArrayInputStream(bytes); validate(input); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } private  AppSchemaValidator(); private  AppSchemaValidator(AppSchemaResolver resolver); }
AppSchemaValidator { public static void validate(String xml) { byte[] bytes = null; String encoding = getEncoding(xml); if (encoding != null) { try { bytes = xml.getBytes(encoding); } catch (UnsupportedEncodingException e) { } } if (bytes == null) { bytes = xml.getBytes(); } InputStream input = null; try { input = new ByteArrayInputStream(bytes); validate(input); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } private  AppSchemaValidator(); private  AppSchemaValidator(AppSchemaResolver resolver); List<String> getFailures(); boolean isFailOnWarning(); void setFailOnWarning(boolean failOnWarning); void parse(InputStream input); void checkForFailures(); static AppSchemaValidator buildValidator(); static AppSchemaValidator buildValidator(AppSchemaResolver resolver); static void validateResource(String name); static void validate(String xml); static void validate(InputStream input); }
AppSchemaValidator { public static void validate(String xml) { byte[] bytes = null; String encoding = getEncoding(xml); if (encoding != null) { try { bytes = xml.getBytes(encoding); } catch (UnsupportedEncodingException e) { } } if (bytes == null) { bytes = xml.getBytes(); } InputStream input = null; try { input = new ByteArrayInputStream(bytes); validate(input); } finally { if (input != null) { try { input.close(); } catch (IOException e) { } } } } private  AppSchemaValidator(); private  AppSchemaValidator(AppSchemaResolver resolver); List<String> getFailures(); boolean isFailOnWarning(); void setFailOnWarning(boolean failOnWarning); void parse(InputStream input); void checkForFailures(); static AppSchemaValidator buildValidator(); static AppSchemaValidator buildValidator(AppSchemaResolver resolver); static void validateResource(String name); static void validate(String xml); static void validate(InputStream input);  }