Xml XSD重用complexType元素

Xml XSD重用complexType元素,xml,xsd,jdeveloper,Xml,Xsd,Jdeveloper,我使用的是jdeveloper12c。我试图使用complexType作为引用,在另一个complexType中键入另一个元素。Jdev告诉我它找不到AddressInfo引用。以下是相关的代码片段,请帮助: <?xml version="1.0" encoding="UTF-8"?> <schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http:/

我使用的是jdeveloper12c。我试图使用
complexType
作为引用,在另一个
complexType
中键入另一个元素。Jdev告诉我它找不到
AddressInfo
引用。以下是相关的代码片段,请帮助:

<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/SquareEdge/SEPPO/ProcessPO"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="AddressInfo">
   <sequence>
       <element type="string" name="FirstName"/>
       <element type="string" name="LastName"/>
       <element type="string" name="Street"/>
       <element type="string" name="City"/>
       <element type="string" name="State"/>
       <element type="short" name="ZipCode"/>
       <element type="unsignedLong" name="PhoneNumber"/>
   </sequence>
</complexType>
<complexType name="Billing">
   <sequence>
     <element name="PaymentCardName" type="string" maxOccurs="1"/>
     <element name="PaymentCardNumber" type="unsignedLong"maxOccurs="1"/>
     <element name="ExpirationDate" type="unsignedShort" maxOccurs="1"/>
     <element name="BillingAddress" maxOccurs="1" type="AddressInfo"/> 
   </sequence>
</complexType>

targetNamespace
定义名称空间前缀:

  xmlns:po="http://xmlns.oracle.com/SquareEdge/SEPPO/ProcessPO"
然后使用它引用
地址信息

  <element name="BillingAddress" maxOccurs="1" type="po:AddressInfo"/> 

你的错误就会消失

总共(加上一些其他小的修复):


<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
        elementFormDefault="qualified"
        xmlns:po="http://xmlns.oracle.com/SquareEdge/SEPPO/ProcessPO"
        targetNamespace="http://xmlns.oracle.com/SquareEdge/SEPPO/ProcessPO"
        xmlns="http://www.w3.org/2001/XMLSchema">
  <complexType name="AddressInfo">
    <sequence>
      <element type="string" name="FirstName"/>
      <element type="string" name="LastName"/>
      <element type="string" name="Street"/>
      <element type="string" name="City"/>
      <element type="string" name="State"/>
      <element type="short" name="ZipCode"/>
      <element type="unsignedLong" name="PhoneNumber"/>
    </sequence>
  </complexType>
  <complexType name="Billing">
    <sequence>
      <element name="PaymentCardName" type="string" maxOccurs="1"/>
      <element name="PaymentCardNumber" type="unsignedLong" maxOccurs="1"/>
      <element name="ExpirationDate" type="unsignedShort" maxOccurs="1"/>
      <element name="BillingAddress" maxOccurs="1" type="po:AddressInfo"/> 
    </sequence>
  </complexType>
</schema>