2015-01-15 184 views
0

我想修改我的XSD以適應相應的XML文件(Test_1.xml)。這裏的要點是,在XML中我遇到一個屬性(屬性的名稱是「類型」)與xsi名稱空間 ...但我不知道如何指定模式定義中的屬性的名稱空間分開XSD命名空間問題

代碼片段:

<ns:return xsi:type="ax261:StatisticsReturnWS" 
      xmlns:ax259="http://ws.transverse.ese.esepa.soprabanking.com/xsd" 
      xmlns:ax263="http://error.transverse.ese.esepa.soprabanking.com/xsd" 
      xmlns:ax262="http://retour.socle.ws.ese.esepa.soprabanking.com/xsd" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:ax261="http://retour.ws.ese.esepa.soprabanking.com/xsd"> 
    <ax262:returnCode>0</ax262:returnCode> 
    <ax261:statisticMessageWS **xsi:type="ax261:StatisticMessageWS"**> 
+0

的可能重複的[如何定義的xsi:?類型如XML的模式的屬性(http://stackoverflow.com/questions/21216778/how-to-define-xsitype-as-an -attribute功能於XML的架構) – kjhughes

回答

1

的xsi:type屬性並不需要在模式中明確宣稱:它是隱式聲明,並允許每個元素。

如果它是某些其他名稱空間屬性,例如xlink:href或xml:id,那麼您需要爲相關名稱空間(xlink或xml)創建(或獲取)模式文檔,確保其包含此屬性的全局屬性聲明,將該模式文檔導入到「主「模式文檔,將前綴綁定到相關的名稱空間URI,然後在複雜類型定義中引用該屬性,例如作爲

<xs:attribute ref="xlink:href"/>