2013-04-29 120 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