class AppSchemaValidator {

    public static void validate(String xml, SchemaCatalog catalog) {
        byte[] bytes = null;
        String encoding = getEncoding(xml);
        if (encoding != null) {
            try {
                bytes = xml.getBytes(encoding);
            } catch (UnsupportedEncodingException e) {
                // ignore, handled below
            }
        }
        if (bytes == null) {
            // no encoding in declaration or unsupported encoding
            // fall back to platform default
            bytes = xml.getBytes();
        }
        InputStream input = null;
        try {
            input = new ByteArrayInputStream(bytes);
            validate(input, catalog);
        } finally {
            if (input != null) {
                try {
                    input.close();
                } catch (IOException e) {
                    // we tried
                }
            }
        }
    }

    private  AppSchemaValidator();
    private  AppSchemaValidator(SchemaResolver resolver);
    private  AppSchemaValidator(SchemaCatalog catalog);

}