[英]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
我找到了這些主題,但它們對我沒有幫助:
針對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.