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

后端 未结 2 565
抹茶落季
抹茶落季 2020-12-01 21:05

With the Android SDK, the following code in a plain empty Activity fails:

@Override
protected void onStart() {
    super.onStart();

    SchemaFactory schema         


        
2条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 21:32

    You might have some luck re-packaging xerces with jarjar and then passing

    "org.apache.xerces.jaxp.validation.XMLSchemaFactory"
    

    to

    SchemaFactory.newInstance(String schemaLanguage, String factoryClassName, ClassLoader classLoader)
    

    if you're using API >=9 or directly instantiating

    org.apache.xerces.jaxp.validation.XMLSchemaFactory 
    

    if you're using API 8. It might not work at all using an older API than that.

提交回复
热议问题