这是定义的XSD文件
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://mule.mulesource.org/schema/esb" 
xmlns:beans="http://www.springframework.org/schema/beans" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns="http://mule.mulesource.org/schema/esb" 
elementFormDefault="qualified" 
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:element name="service">
<xsd:complexType>
<xsd:complexContent>
<xsd:extension base="beans:identifiedType">
<xsd:sequence minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="method" />
</xsd:sequence>
<xsd:attribute name="provider" type="xsd:string" use="required"/>
<xsd:attribute name="protocol" type="xsd:string" />
<xsd:attribute name="interceptor" type="xsd:string" />
<xsd:attribute name="transactionTemplate" type="xsd:string" />
<xsd:attribute name="transactionMethod" type="xsd:string" />
<xsd:attribute name="servicePoolSize" type="xsd:string" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="method">
<xsd:complexType>
<xsd:attribute name="name" type="xsd:string" use="required"/>
     <xsd:attribute name="converter" type="xsd:string" />
<xsd:attribute name="interceptor" type="xsd:string" />
<xsd:attribute name="isReAck" type="xsd:boolean" />
<xsd:attribute name="retry" type="xsd:int" />
</xsd:complexType>
</xsd:element>


<!-- Client Definition -->
<xsd:element name="client" type="clientType"/>
<xsd:complexType name="clientType">
<xsd:complexContent>
<xsd:extension base="beans:identifiedType">
<xsd:sequence>
<xsd:element name="defaultHeader" type="headerType" 
                                             minOccurs="0" maxOccurs="1"/>
<xsd:element name="method" type="methodType" minOccurs="0" 
                                             maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="interface" type="xsd:string"  use="required"/>
<xsd:attribute name="interceptor" type="xsd:string" />
<xsd:attribute name="namespaceUri" type="xsd:string" />
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="methodType">
<xsd:sequence>
<xsd:element name="header" type="headerType" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
<xsd:attribute name="interceptor" type="xsd:string" />
<xsd:attribute name="bindingClass" type="xsd:string" />
<xsd:attribute name="async" type="xsd:string" />
<xsd:attribute name="actionName" type="xsd:string" />
<xsd:attribute name="ignoreReturn" type="xsd:string" />
<xsd:attribute name="synTraService" type="xsd:string" />
</xsd:complexType>

<xsd:complexType name="headerType">
<xsd:attribute name="ref" type="xsd:string"/>
<xsd:attribute name="endpoint" type="xsd:string"/>
<xsd:attribute name="brokerEndpoint" type="xsd:string"/>
<xsd:attribute name="groupId" type="xsd:string"/>
<xsd:attribute name="timeout" type="xsd:string"/>
<xsd:attribute name="connectTimeout" type="xsd:string"/>
<xsd:attribute name="quantity" type="xsd:string"/>
<xsd:attribute name="priority" type="xsd:string"/>
</xsd:complexType>

</xsd:schema>通过下面命令执行后:
scomp -out esb-ext.jar esb-ext.xsd报错如图:

解决方案 »

  1.   

    内容如下:C:\Documents and Settings\wb-qiuf\桌面\xmlbean bak>scomp -out esb-ext.jar esb-ext.xsd
    C:\Documents and Settings\wb-qiuf\桌面\xmlbean bak\esb-ext.xsd:39:4: error: src-resolve: type 'identifiedType@http://www
    .springframework.org/schema/beans' not found.
    C:\Documents and Settings\wb-qiuf\桌面\xmlbean bak\esb-ext.xsd:10:5: error: src-resolve: type 'identifiedType@http://www
    .springframework.org/schema/beans' not found.
    Time to build schema type system: 0.797 seconds
    BUILD FAILED
    C:\Documents and Settings\wb-qiuf\桌面\xmlbean bak>
      

  2.   

    type:
    springframework.org/schema/beans'
    not found没有找到,就是你的xsd文档不符合springframework.org/schema/beans的要求!我要提个问题?
    如何证明你是美女?
      

  3.   

    各位. 经过精心的研究, 问题已解决....解决方法是: 
    File file = new File("D:/WorkSpace/settlecore/settlecore/ext/service/pom.xml");//XmlOptions这个对象最为重要, 利用这个对象将namespace设置好, 然后再传入parse()方法..问题搞定
    XmlOptions xo = new XmlOptions();
    Map namespaceMap = new HashMap<String, String>();
    namespaceMap.put("", "http://maven.apache.org/POM/4.0.0");
    xo.setLoadSubstituteNamespaces(namespaceMap);
            
    ProjectDocument pd = ProjectDocument.Factory.parse(file, xo);