ns2:extraAtt
,您需要一个类似于以下模式文档的文档:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/my-ns2">
<xs:attribute name="extraAtt" type="xs:anySimpleType"/>
</xs:schema>
<xs:attribute ref="ns2:extraAtt"/>
)或者属性通配符(<xs:anyAttribute namespace="http://example.com/my-ns2"/>
或类似的方式)来实现。很抱歉规范的可读性不佳,这是一个漫长的故事,但基本上WG的一些成员认为像您这样的人不存在(“除了实现者,没有人会阅读规范,只要他们不抱怨它足够可读”——至少在一些实现者抱怨之前是这样说的,后来他们就转移了话题)。要声明属性,您可以使用此XSD:
<xs:schema
targetNamespace="theNamespaceUri"
elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns="theNamespaceUri"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:attribute name="extraAtt" type="xs:string">
</xs:attribute>
</xs:schema>
extraAtt
是一个简单的字符串——您可以使用任何类型,或限制现有类型等。)