【发布时间】:2016-08-31 12:52:43
【问题描述】:
我需要使用 SAXParser 读取位于 S3 中的 xml 文件。我找到了很多关于如何在 S3 中读取法线的示例,但没有任何与我的问题相关的材料。
我使用 SAXParser 的原因是因为我需要验证 XML 文件。以下是验证本地 xml 文件的代码示例。
Source schemaFile = new StreamSource(entitiesScriptSchema);
System.out.println(path);
Source xmlFile = new StreamSource(new File(path));
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
Schema schema = schemaFactory.newSchema(schemaFile);
Validator validator = schema.newValidator();
validator.validate(xmlFile);
【问题讨论】:
标签: java xml amazon-s3 aws-sdk saxparser