2013-04-29 170 views
1

我想生成以下XSD错误而在日食

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    targetNamespace="http://abc.com/mmm/trt" attributeFormDefault="unqualified" 
    elementFormDefault="qualified"> 
    <xs:annotation> 
     <xs:documentation>Schema for Cache Refresh Event. 
     </xs:documentation> 
    </xs:annotation> 
    <xs:simpleType name="cacheCode"> 
     <xs:restriction base="xs:string"> 
      <xs:enumeration value="BUSINESS_RULE" /> 
      <xs:enumeration value="USER" /> 
     </xs:restriction> 
    </xs:simpleType> 
    <xs:element name="cacheRefreshEvent"> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:element name="cacheCode" type="cacheCode" minOccurs="1" 
        maxOccurs="1" /> 
       <xs:element name="entityRefId" type="xs:string" minOccurs="0" 
        maxOccurs="20" /> 
       <xs:element name="cacheRefreshDate" type="xs:dateTime" 
        minOccurs="1" maxOccurs="1" /> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
</xs:schema> 

JAXB模式,但,这是给我下面的错误,我在Eclipse控制台得到了XSD生成JAXB模型

parsing a schema... 
[ERROR] src-resolve.4.1: Error resolving component 'cacheCode'. It was detected that 'cacheCode' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/F:/Sprint6/cache/src/main/resources/CacheRefreshEvent.xsd'. If 'cacheCode' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'cacheCode' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/F:/Sprint6/cache/src/main/resources/CacheRefreshEvent.xsd'. 
    line 18 of file:/F:/Sprint6/cache/src/main/resources/CacheRefreshEvent.xsd 

Failed to parse a schema. 

请帮忙。

+0

我不知道,但我猜你需要使用有点像 2013-04-29 13:19:28

+0

nopes,它没有工作 – Anand 2013-04-29 13:22:36

+0

是否从它删除类型属性..”“ – 2013-04-29 13:33:33

回答

2

删除这个多余的命名空间属性的targetNamespace = “http://www.hcentive.com/mea/trr”

或添加这个的xmlns =“http://www.hcentive.com/ MEA/TRR “

这两种解决方案将工作:)

为您引用targetnamespace-and-xmlns

+0

它的工作..谢谢你非常 :) – Anand 2013-04-29 16:51:28