Android XML validation using XSD ( both xerces and SchemaFactory) error

925 views Asked by At

Now, I'm having some pb with XML validation using XSD.

Since I use SchemaFactory:

SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);

It give me:

Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lorg/apache/xerces/impl/xs/SchemaGrammar;
Exception Ljava/lang/ExceptionInInitializerError; thrown while initializing Lorg/apache/xerces/impl/xs/XSConstraints;
java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema

Then I tried to switch to apache xerces and got this error (since importing xerces):

Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_31\bin\java.exe'' finished with non-zero exit value 1

I found these topics but they didn't help me:

Validator (xsd) for xml in android

xml schema conversion issue against xsd giving Illeagal exception in android applications

SchemaFactory doesn't support W3C XML Schema in platform level 8?

why java.exe exit with value 1 in android studio

I'm using Android Studio 1.2.2 and an Android 4.4.2. Any suggestion for me? Thanks,

1

There are 1 answers

0
Anh-Tuan Mai On BEST ANSWER