문제

How to validate an XML file against an XSD local file without connecting to a server using a SAX parser?
What to add and where?
How to change this code?

schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(xs);
도움이 되었습니까?

해결책

As I understand the question you are asking how to connect a local file as a scheme Example

Source schemaFile = new StreamSource(new ClassPathResource("datTag.xsd").getInputStream());
        SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
        schema = schemaFactory.newSchema(schemaFile);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top