Schematron validering java
Hejsa.Hvordan validerer jeg et xml document med denne
http://rep.oio.dk/ubl/xml/schemas/0p71/schematron/OIOEfakturaSchematron.xsl ?
Jeg forsøger mig lige nu med
SchemaFactory schemaFacotry = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
//schematronSchemaSource Streamsource med xsllen der skal valideres med
Schema schema = schemaFacotry.newSchema(schematronSchemaSource);
//Inputsource med xmllen der skal valideres
schema.newValidator().validate(new SAXSource(is));
Ovenstående giver bare følgende fejl.
Det er meget vigtigt at det performer da der skal valideres mange både store og små dokumenter.
GenericDocumentException: app=1.10,err=3.0([org.apache.xerces.impl.xs.XMLSchemaLoader: method loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V not found])
at dk.company.genericdocumentprocess.documentdata.OIOInvoiceValidator.schematronValidate(OIOInvoiceValidator.java:152)
at dk.company.genericdocumentprocess.documentdata.OIOInvoiceValidator.validateDocument(OIOInvoiceValidator.java:60)
at dk.company.junits.TestXml.testOIOInvoiceValidator(TestXml.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at junit.framework.TestCase.runTest(TestCase.java:166)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Caused by: java.lang.NoSuchMethodError: org.apache.xerces.impl.xs.XMLSchemaLoader: method loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V not found
at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
at javax.xml.validation.SchemaFactory.newSchema(Unknown Source)
at dk.company.genericdocumentprocess.documentdata.OIOInvoiceValidator.schematronValidate(OIOInvoiceValidator.java:112)
at dk.company.genericdocumentprocess.documentdata.OIOInvoiceValidator.validateDocument(OIOInvoiceValidator.java:60)
at dk.company.junits.TestXml.testOIOInvoiceValidator(TestXml.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at junit.framework.TestCase.runTest(TestCase.java:166)
at junit.framework.TestCase.runBare(TestCase.java:140)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:131)
at junit.framework.TestSuite.runTest(TestSuite.java:173)
at junit.framework.TestSuite.run(TestSuite.java:168)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
