我正在尝试针对 XSD 验证非常 XML(~200MB)。大约需要3个小时。我不确定我在这里做错了什么?
SchemaFactory sf = SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
Schema schema = sf.newSchema(new File(this.productExtraInfoXsd));
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true);
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse(new File(filePath));
DOMSource domSource = new DOMSource(doc);
DOMResult result = new DOMResult();
Validator validator = schema.newValidator();
validator.validate(domSource, result);