模式正确性检查
在使用XJC时,我们看到了一个类似的问题(请参阅下面的链接),该问题通过禁用模式正确性检查得以解决:
- http://wiki.eclipse.org/Eclipselink/Examples/MOXy/Dynamic/JAXBContextFromXMLSchema
尝试使用以下系统属性来禁用架构正确性检查。
-Dcom.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.noCorrectnessCheck=true
对于Ant,请尝试:
<xjc target="src"> <schema dir="src" includes="**debug.xsd"/> <arg value="-nv" /></xjc>
从下一页开始,-nv参数与模式正确性检查有关:
- http://fisheye5.atlassian.com/browse/~raw,r=1.1/jaxb/www/2.1-ea1/docs/xjcTask.html
进入守则
您可以尝试以编程方式与XJC进行交互(请参见下文),并插入自己的EntityResolver以查看导入/包含在哪里失败:
import com.sun.premodel.*;import com.sun.tools.xjc.*;import com.sun.tools.xjc.api.*;SchemaCompiler sc = XJC.createSchemaCompiler();sc.setEntityResolver(new YourEntityResolver());sc.setErrorListener(new YourErrorListener());sc.parseSchema(SYSTEM_ID, element);S2JJAXBModel model = sc.bind();


![JAXB Ant任务错误:xjc2 [ERROR]空的未知位置 JAXB Ant任务错误:xjc2 [ERROR]空的未知位置](http://www.mshxw.com/aiimages/31/497271.png)
