如何创建通用XSD类型 [英] How to create a generic XSD type

查看:77
本文介绍了如何创建通用XSD类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a java application where i can map a XSD type to another with same type. Now i have requirement to have one anyType xsd to which i can map any type. Like as we have Object type in java, is it possible to create like in XSD.

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

At complex type level is it possible.

推荐答案

是的,这是可能的。类型为 xsd:anyType 。以下是一个示例:

Yes, it's possible. The type is xsd:anyType. Here's an example:

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

(取自引物

这是一个更复杂的例子:

Here's a more complex example:

<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>

(从入门书开始 - 值得一看)

(From the primer as well - it's worth looking at at it)

这篇关于如何创建通用XSD类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆