2015-01-15 301 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"/>