繁体   English   中英

使用XSD(xerces和SchemaFactory)的Android XML验证错误

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

现在,我正在使用XSD进行XML验证。

由于我使用SchemaFactory:

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

它给我:

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

然后我尝试切换到Apache xerces并收到此错误(由于导入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

我找到了这些主题,但它们对我没有帮助:

Android中XML的验证器(XSD)

针对xsd的XML模式转换问题在Android应用程序中提供了Illeagal异常

SchemaFactory在平台级别8中不支持W3C XML Schema吗?

为什么在Android Studio中以值1退出java.exe

我正在使用Android Studio 1.2.2和Android 4.4.2。 对我有什么建议吗? 谢谢,

简短答案:适用于Android的xerces: https//code.google.com/p/xerces-for-android/source/checkout

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM