编译架构时出现异常
我们正在尝试解析 XSD 并从中构建属性表(使用 XML Bean)。
代码如下:
XmlObject xmlObj = XmlObject.Factory.parse( schema ); sts = XmlBeans.compileXsd(new XmlObject[] { xmlObj }, XmlBeans.getBuiltinTypeSystem(), null);
调用compileXsd 抛出异常并显示消息: 第 0 个提供的输入不是架构文档:其类型为 N=
我们的架构如下所示:
<schema xmlns:com.co.workflow="com.co.workflow" xmlns:org.data="org.data" targetNamespace="org.activity" version="1.0"> <complexType class="org.activity.ExecuteCommand" name="executeCommand"> <complexContent> ... ...
堆栈跟踪:
The 0th supplied input is not a schema document: its type is N= at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:211) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667) at org.apache.xmlbeans.XmlBeans.compileXsd(XmlBeans.java:553) ......
We're trying to parse an XSD and build a property sheet out of that (using XML Beans).
The code is as following:
XmlObject xmlObj = XmlObject.Factory.parse( schema ); sts = XmlBeans.compileXsd(new XmlObject[] { xmlObj }, XmlBeans.getBuiltinTypeSystem(), null);
Call to compileXsd throws the an exception with message: The 0th supplied input is not a schema document: its type is N=
Our schema looks like this:
<schema xmlns:com.co.workflow="com.co.workflow" xmlns:org.data="org.data" targetNamespace="org.activity" version="1.0"> <complexType class="org.activity.ExecuteCommand" name="executeCommand"> <complexContent> ... ...
Stack trace:
The 0th supplied input is not a schema document: its type is N= at org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler.compile(SchemaTypeSystemCompiler.java:211) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.xmlbeans.XmlBeans.compileXmlBeans(XmlBeans.java:667) at org.apache.xmlbeans.XmlBeans.compileXsd(XmlBeans.java:553) ......
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在某处读到传递给 XmlBeans.compileXsd 的对象需要是 SchemaDocument 的实例。所以试试这个:
SchemaDocument.Factory.parse
而不是XmlObject.Factory.parse
I read somewhere that the object passed to XmlBeans.compileXsd needs to be an Instance of SchemmaDocument. So try this:
SchemaDocument.Factory.parse
instead ofXmlObject.Factory.parse