2013-03-27 72 views
0

我是模式構建的新手,並且在理解命名空間引用應該如何工作時遇到問題。我使用類似於BizTalk的應用程序,並對以下模式執行解封操作。我不知道如果這是一個一般錯誤,但是這是我得到的錯誤:XML架構參考和類型未聲明

錯誤

XmlSchemaValidationException, Type 'http://Wheelhouse/Property:PropertyType' is not declared. : 

屬性定義

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns="http://Wheelhouse/Property" elementFormDefault="qualified" targetNamespace="http://Wheelhouse/Property" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="Property" type="PropertyType" /> 
    <xs:complexType name="PropertyType"> 
    <xs:sequence> 
     <xs:element minOccurs="0" maxOccurs="1" name="ID" /> 
     <xs:element minOccurs="0" maxOccurs="1" name="Listing_Number" /> 
     <xs:element minOccurs="0" maxOccurs="1" name="Status" /> 
    </xs:sequence> 
    </xs:complexType> 
</xs:schema> 

屬性列表定義

<?xml version="1.0" encoding="utf-16"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:import schemaLocation="blueintegrator://Wheelhouse/PropertyDefinition__4f3f265569d54e9fa898eba835502c6a_" namespace="http://Wheelhouse/Property" /> 
    <xs:element xmlns="http://Wheelhouse/Property" name="Root"> 
    <xs:complexType> 
     <xs:sequence> 
     <xs:element minOccurs="0" maxOccurs="unbounded" name="Property" type="PropertyType" /> 
     </xs:sequence> 
    </xs:complexType> 
    </xs:element> 
</xs:schema> 

回答

0

它不工作的原因與schemaLocation屬性中的URI方案(blueintegrator)有關。您使用的用於使用XSD的工具很可能不理解該URI,因此無法加載包含http://Wheelhouse/Property:PropertyType類型定義的XSD。

對於「正常」工具,如果您將該屬性的值更改爲其他值(例如,如果將兩個文件都放在同一文件夾中,則將整個schemaLocation值替換爲文件名)看到模式是完全有效的。