如何创建通用XSD类型

问题描述

是的,有可能。类型是xsd:anyType。这是一个例子:

<xsd:element name="anything" type="xsd:anyType"/>

(摘自底漆

这是一个更复杂的示例:

<xsd:complexType>
  <xsd:complexContent>
    <xsd:restriction base="xsd:anyType">
      <xsd:attribute name="currency" type="xsd:string"/>
      <xsd:attribute name="value"    type="xsd:decimal"/>
    </xsd:restriction>
  </xsd:complexContent>
</xsd:complexType>

(也从底漆开始-值得一看)

解决方法

我有一个Java应用程序,可以在其中将XSD类型映射到另一个具有相同类型的类型。现在,我需要拥有一个可以映射任何类型的anyType
xsd。就像我们在Java中拥有Object类型一样,是否有可能在XSD中创建类似对象。

编辑:在复杂类型级别是可能的。