String language = "http://www.w3.org/XML/XMLSchema/v1.1";SchemaFactory factory = SchemaFactory.newInstance(language);
拜托,任何人都可以帮助我。提前致谢。
最佳答案
XSD 1.1
Stock JDK不支持XSD 1.1。为此,您需要Saxon或Xerces。见How to validate XML against XSD 1.1 in Java?
XSD 1.0
如果XSD 1.0支持足够,则可以更改
String language = "http://www.w3.org/XML/XMLSchema/v1.1";
SchemaFactory factory = SchemaFactory.newInstance(language);
至
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);