1
在XML架構中,如何定義呈現如下所示的ComplexType
?帶有屬性和字符串內容的XML元素
<ValidationError code="X501">I love cats!</ValidationError>
如果我嘗試以下方法我的工具*會說,這不是有效的
<xsd:complexType name="ValidationErrorType">
<xsd:attribute name="code" type="xsd:string"></xsd:attribute>
<xsd:simpleContent>
<xsd:extension base="xs:string"/>
</xsd:simpleContent>
</xsd:complexType>
工具,我用的都是Altova公司的XMLSpy的可視化編輯和WSDL2Java生成的類
更新:我有試圖another flavour
<xsd:complexType name="ValidationErrorType">
<xsd:simpleContent>
<xsd:extension base="xs:string">
<xsd:attribute name="code" type="xsd:string" />
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
的Altova說Invalid XML schema: 'Value 'xs:string' is not allowed for attribute 'base'.'