- 讲师:刘萍萍 / 谢楠
- 课时:160h
- 价格 4580 元
特色双名师解密新课程高频考点,送国家电网教材讲义,助力一次通关
配套通关班送国网在线题库一套
最近对Schema 验证研究了一下, 代码
所需JAR包需要自己下载(版本一定要正确)
public class SchemaValidation {
public static void main(String args) {
}
public static void validate() {
SchemaValidation demo = new SchemaValidation();
InputStream xmlString = demo.getClass().getResourceAsStream("GBAInit.xml");
System.out.println("XSD parse successfully !");
Document document = reader.read(xmlString);
} catch (DocumentException e) {
Throwable nestedException = e.getNestedException();
System.out.println("NestedException: " + nestedException);
} else {
}
System.out.println("Exception occurred: " + t);
}
/** Registers the Verifier with the SAXReader */
System.out.println("Loaded schema document: " + schemaURI);
// use autodetection of schemas
Schema schema = factory.compileSchema(schemaURI);
Verifier verifier = schema.newVerifier();
public void error(SAXParseException e) {
}
public void fatalError(SAXParseException e) {
}
public void warning(SAXParseException e) {
}
// now install the verifying filter
SAXReader reader = new SAXReader();
return reader;
责编:罗莉
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
课程专业名称 |
讲师 |
课时 |
查看课程 |
---|
点击加载更多评论>>