因此,我使用trang解析了一堆XML以生成一个巨大的模式文件,这一切都很顺利。但是,当我尝试使用xjc生成源代码时,我得到了以下错误,
xjc reutersXMLSchema.xsd
parsing a schema...
[ERROR] no-xsi: The {target namespace} of an attribute declaration must not match 'http://www.w3.org/2001/XMLSchema-instance'.
line 11 of file:/Users/cqin/Downloads/trang-20081028/xsi.xsd
Failed to parse a schema.该模式如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.w3.org/2001/XMLSchema-instance" xmlns:filter="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/filter" xmlns:ns0="http://www.reuters.com/ns/2006/05/01/webservices/rkd/News_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/headlineml" xmlns:cache_1="http://www.reuters.com/ns/2008/03/01/webservices/rkd/Cache_1" xmlns:ns2="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1" xmlns:global="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1" xmlns:a="http://www.w3.org/2005/08/addressing">
<xs:import namespace="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/filter" schemaLocation="filter.xsd"/>
<xs:import namespace="http://schemas.reuters.com/ns/2006/04/14/rmds/webservices/news/headlineml" schemaLocation="ns1.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2006/05/01/webservices/rkd/Common_1" schemaLocation="global.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2006/05/01/webservices/rkd/News_1" schemaLocation="reutersXMLSchema.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2006/05/01/webservices/rkd/TokenManagement_1" schemaLocation="ns2.xsd"/>
<xs:import namespace="http://www.reuters.com/ns/2008/03/01/webservices/rkd/Cache_1" schemaLocation="cache_1.xsd"/>
<xs:import namespace="http://www.w3.org/2003/05/soap-envelope" schemaLocation="s.xsd"/>
<xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="a.xsd"/>
<xs:attribute name="type" type="xs:NCName"/>
</xs:schema>你知道为什么它不能工作吗?
我尝试将targetNameSpace更改为某个唯一的值,但得到了更多的错误,所以我想知道是否可以对原始错误做些什么。
谢谢!
发布于 2012-01-13 07:11:04
是的,这是不正确的:
targetNamespace="http://www.w3.org/2001/XMLSchema-instance"这就是说,模式的目标名称空间实际上是模式定义模式本身的名称空间(即定义<xs:schema>和<xs:import>等实际含义的模式)。这个模式是固定的,您不能针对它编写自己的模式,这就是XJC拒绝它的原因。
我尝试将targetNameSpace更改为独一无二的值,但得到的错误更多
继续尝试,你会比你现在拥有的东西走得更远。然而,trang生成这个糟糕的模式的事实表明,您在这条线上做了一些错误的事情。也许您要求它生成一个包含http://www.w3.org/2001/XMLSchema-instance模式本身的组合模式,这几乎肯定不是您想要做的。
https://stackoverflow.com/questions/8843588
复制相似问题