首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >尝试使用XJC生成架构时出错

尝试使用XJC生成架构时出错
EN

Stack Overflow用户
提问于 2012-01-13 06:56:43
回答 1查看 2.5K关注 0票数 1

因此,我使用trang解析了一堆XML以生成一个巨大的模式文件,这一切都很顺利。但是,当我尝试使用xjc生成源代码时,我得到了以下错误,

代码语言:javascript
复制
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.

该模式如下所示:

代码语言:javascript
复制
<?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更改为某个唯一的值,但得到了更多的错误,所以我想知道是否可以对原始错误做些什么。

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-01-13 07:11:04

是的,这是不正确的:

代码语言:javascript
复制
targetNamespace="http://www.w3.org/2001/XMLSchema-instance"

这就是说,模式的目标名称空间实际上是模式定义模式本身的名称空间(即定义<xs:schema><xs:import>等实际含义的模式)。这个模式是固定的,您不能针对它编写自己的模式,这就是XJC拒绝它的原因。

我尝试将targetNameSpace更改为独一无二的值,但得到的错误更多

继续尝试,你会比你现在拥有的东西走得更远。然而,trang生成这个糟糕的模式的事实表明,您在这条线上做了一些错误的事情。也许您要求它生成一个包含http://www.w3.org/2001/XMLSchema-instance模式本身的组合模式,这几乎肯定不是您想要做的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8843588

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档