加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 教程 > 正文

详解Eclipse XSD 生成枚举类型的Schema的示例

发布时间:2023-06-21 13:44:04 所属栏目:教程 来源:
导读:由于互联网上没有关于Eclipse XSD的中文信息,也没有关于Eclipse XSD的示例代码,但有时我们需要生成一个简单的带有枚举限制的XSD模式类型,下文是错新技术频道小编为你带来的介绍。

Eclipse XSD 生成枚举类型的
由于互联网上没有关于Eclipse XSD的中文信息,也没有关于Eclipse XSD的示例代码,但有时我们需要生成一个简单的带有枚举限制的XSD模式类型,下文是错新技术频道小编为你带来的介绍。
 
Eclipse XSD 生成枚举类型的Schema的实例详解
 
<?xml version="1.0" encoding="UTF-8"?><schema xmlns="http://www.w3.org/2001/XMLSchema"  targetNamespace="http://www.w3.org/2001/XMLSchema">    <complexType name="StudentType">     <sequence>      <element maxOccurs="1" minOccurs="1" name="username" type="string"/>      <element maxOccurs="1" minOccurs="1" name="password" type="string"/>      <element maxOccurs="1" minOccurs="1" name="alignment" type="AlignmentType"/>     </sequence>    </complexType>    <simpleType name="AlignmentType">     <restriction base="string">      <enumeration value="RIGHT"/>      <enumeration value="MIDDLE"/>      <enumeration value="LEFT"/>     </restriction>    </simpleType>    <element name="Student" type="StudentType"/>   </schema>
 
其中, <SimpleType name="AlignmentType"> 代表的就是一个带枚举限定的简单类型。那么应该如何生成呢?请见参考下面的代码。
 
import org.eclipse.xsd.XSDComplexTypeDefinition; import org.eclipse.xsd.XSDCompositor; import
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!